提交 f8f7bd97 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Correct DATEADD description in help.csv

上级 04c2fd11
...@@ -3668,12 +3668,15 @@ CURRENT_TIMESTAMP() ...@@ -3668,12 +3668,15 @@ CURRENT_TIMESTAMP()
"Functions (Time and Date)","DATEADD"," "Functions (Time and Date)","DATEADD","
{ DATEADD| TIMESTAMPADD } (unitString, addIntLong, timestamp) { DATEADD| TIMESTAMPADD } (unitString, addIntLong, timestamp)
"," ","
Adds units to a timestamp. The string indicates the unit. Adds units to a date-time value. The string indicates the unit.
Use negative values to subtract units. Use negative values to subtract units.
addIntLong may be a long value when manipulating milliseconds, addIntLong may be a long value when manipulating milliseconds,
otherwise it's range is restricted to int. otherwise it's range is restricted to int.
The same units as in the EXTRACT function are supported. The same units as in the EXTRACT function are supported.
DATEADD method returns a timestamp. TIMESTAMPADD method returns a long. DATEADD method returns a value with the same type as specified value if unit is compatible with this value.
If specified unit is a HOUR, MINUTE, SECOND, MILLISECOND, etc and value is a DATE value DATEADD returns combined TIMESTAMP.
Units DAY, MONTH, YEAR, WEEK, etc are not allowed for TIME values.
TIMESTAMPADD method returns a long.
"," ","
DATEADD('MONTH', 1, DATE '2001-01-31') DATEADD('MONTH', 1, DATE '2001-01-31')
" "
......
...@@ -1817,7 +1817,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -1817,7 +1817,7 @@ public class Function extends Expression implements FunctionCall {
case YEAR: case YEAR:
case MONTH: { case MONTH: {
if (!withDate) { if (!withDate) {
throw DbException.getInvalidValueException("DATEADD timestamp", v); throw DbException.getInvalidValueException("DATEADD time part", part);
} }
long year = DateTimeUtils.yearFromDateValue(dateValue); long year = DateTimeUtils.yearFromDateValue(dateValue);
long month = DateTimeUtils.monthFromDateValue(dateValue); long month = DateTimeUtils.monthFromDateValue(dateValue);
...@@ -1838,7 +1838,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -1838,7 +1838,7 @@ public class Function extends Expression implements FunctionCall {
case DAY_OF_MONTH: case DAY_OF_MONTH:
case DAY_OF_YEAR: case DAY_OF_YEAR:
if (!withDate) { if (!withDate) {
throw DbException.getInvalidValueException("DATEADD timestamp", v); throw DbException.getInvalidValueException("DATEADD time part", part);
} }
dateValue = DateTimeUtils.dateValueFromAbsoluteDay( dateValue = DateTimeUtils.dateValueFromAbsoluteDay(
DateTimeUtils.absoluteDayFromDateValue(dateValue) + count); DateTimeUtils.absoluteDayFromDateValue(dateValue) + count);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论