DATEADD()
Available in: DSQL, PSQLAdded in: 2.1
Description: Adds the specified number of years, months, days, hours, minutes, seconds or milliseconds to a date/time value.
Result type: DATE, TIME or TIMESTAMP
Syntax:
DATEADD () args::=TO
| , , amount::= an integer expression (negative to subtract)
unit::= YEAR | MONTH | DAY
| HOUR | MINUTE | SECOND | MILLISECONDdatetime::= a DATE, TIME or TIMESTAMP expression
dateadd (28 day to current_date)dateadd (-6 hour to current_time)dateadd (month, 9, DateOfConception)dateadd (minute, 90, time 'now')dateadd (? year to date '11-Sep-1973')DATEDIFF()
Available in: DSQL, PSQL Added in: 2.1
Description: Returns the number of years, months, days, hours, minutes, seconds or milliseconds elapsed between two date/time values.
Result type: BIGINT
Syntax:
DATEDIFF () ::=FROMTO
| , , ::= YEAR | MONTH | DAY
| HOUR | MINUTE | SECOND | MILLISECOND::= a DATE, TIME or TIMESTAMP expression
datediff (year, date '1-Jan-2009', date '31-Dec-2009')” returns 0, but datediff (year, date '31-Dec-2009', date '1-Jan-2010')” returns 1 datediff (day, date '26-Jun-1908', date '11-Sep-1973')” returns 23818 moment2 lies before moment1. datediff (hour from current_timestamp to timestamp '12-Jun-2059 06:00')datediff (minute from time '0:00' to current_time)datediff (month, current_date, date '1-1-1900')datediff (day from current_date to cast(? as date))
