mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 10:00:38 +01:00
Update doc for DATEADD and DATEDIFF.
This commit is contained in:
parent
363ba2aa23
commit
7cc216e732
@ -276,12 +276,16 @@ Format:
|
||||
DATEADD( <number> <timestamp_part> TO <date_time> )
|
||||
DATEADD( <timestamp_part>, <number>, <date_time> )
|
||||
|
||||
timestamp_part ::= { YEAR | MONTH | DAY | HOUR | MINUTE | SECOND | MILLISECOND }
|
||||
timestamp_part ::= { YEAR | MONTH | DAY | WEEK | HOUR | MINUTE | SECOND | MILLISECOND }
|
||||
|
||||
Notes:
|
||||
1) YEAR, MONTH, DAY and WEEKDAY could not be used with time values.
|
||||
2) HOUR, MINUTE and SECOND could not be used with date values.
|
||||
1) WEEKDAY and YEARDAY cannot be used. It doesn't make sense.
|
||||
2) YEAR, MONTH and DAY could not be used with time values.
|
||||
3) All timestamp_part values could be used with timestamp values.
|
||||
4) When using hour, minute, second and millisecond for dateAdd and dates, the quantity added or
|
||||
substracted should account at least for one day to produce effect (IE adding 23 hours to a date
|
||||
doesn't increment it).
|
||||
|
||||
|
||||
Example:
|
||||
select dateadd(-1 day for current_date) as yesterday
|
||||
@ -300,12 +304,14 @@ Format:
|
||||
DATEDIFF( <timestamp_part> FROM <date_time> TO <date_time> )
|
||||
DATEDIFF( <timestamp_part>, <date_time>, <date_time> )
|
||||
|
||||
timestamp_part ::= { YEAR | MONTH | DAY | WEEK | HOUR | MINUTE | SECOND | MILLISECOND }
|
||||
|
||||
Notes:
|
||||
1) Returns positive value if the second value is greater than the first one,
|
||||
negative when the first one is greater or zero when they are equal.
|
||||
2) Comparison of date with time values is invalid.
|
||||
3) YEAR, MONTH, DAY and WEEKDAY could not be used with time values.
|
||||
4) HOUR, MINUTE and SECOND could not be used with date values.
|
||||
3) WEEKDAY and YEARDAY cannot be used. It doesn't make sense.
|
||||
4) YEAR, MONTH and DAY could not be used with time values.
|
||||
5) All timestamp_part values could be used with timestamp values.
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user