TIMESTAMPADD function (ODBC compatible)
Syntax
TIMESTAMPADD(interval, integer_exp, date_time_exp)
interval::
SQL_TSI_FRAC_SECOND
| SQL_TSI_SECOND
| SQL_TSI_MINUTE
| SQL_TSI_HOUR
| SQL_TSI_DAY
| SQL_TSI_DAYOFYEAR
| SQL_TSI_WEEK
| SQL_TSI_MONTH
| SQL_TSI_QUARTER
| SQL_TSI_YEAR
| MILLISECOND
| SECOND
| MINUTE
| HOUR
| DAY
| DAYOFYEAR
| WEEK
| MONTH
| QUARTER
| YEAR
Description
Returns the timestamp calculated by adding integer_exp intervals of type interval to timestamp_exp.
Arguments
Keywords such as SECOND and HOUR are functionally equivalent to the keywords with the same name but having prefix SQL_TSI, i.e., the keywords such as SQL_TSI_SECOND and SQL_TSI_HOUR. The keyword MILLISECOND is the same as SQL_TSI_FRAC_SECOND and this interval means milliseconds. The keyword DAYOFYEAR or SQL_TSI_DAYOFYEAR indicates an interval value which ranges from 1 to 366 (See scalar function DAYOFYEAR()).
Example
The following example displays the current system time and uses the TIMESTAMPADD scalar function to add 8 hours to it.
> select systime, timestampadd(sql_tsi_hour, 8, systime) from syscalctable;
15:03:57:000 06/08/1999 23:03:57:000
------------ -----------------------
15:03:57:000, 1999-06-08 23:03:57:000