background image
<< substring function | year function >>

TIMESTAMPADD function

<< substring function | year function >>
Derby Reference Manual
329
The JDBC escape syntax
{fn curdate()}
is equivalent to the built-in syntax
CURRENT_DATE
. For more information, see
CURRENT_DATE function
.
curtime
Returns the current time.
curtime()
The JDBC escape syntax
{fn curtime()}
is equivalent to the built-in syntax
CURRENT_TIME
. For more information, see
CURRENT_TIME function
.
hour
Returns the hour part of a time value.
hour(expression)
The JDBC escape syntax
{fn hour(expression)}
is equivalent to the built-in
syntax
HOUR(expression)
. For more information, see
HOUR function
.
minute
Returns the minute part of a time value.
minute(expression)
The JDBC escape syntax
{fn minute(expression)}
is equivalent to the built-in
syntax
MINUTE(expression)
. For more information, see
MINUTE function
.
month
Returns the month part of a date value.
month(expression)
The JDBC escape syntax
{fn month(expression)}
is equivalent to the built-in
syntax
MONTH(expression)
. For more information, see
MONTH function
.
second
Returns the seconds part of a time value.
second(expression)
The JDBC escape syntax
{fn second(expression)}
is equivalent to the built-in
syntax
SECOND(expression)
. For more information, see
SECOND function
.
TIMESTAMPADD
Use the
TIMESTAMPADD
function to add the value of an interval to a timestamp. The
function applies the integer to the specified timestamp based on the interval type and
returns the sum as a new timestamp. You can subtract from the timestamp by using
negative integers.
TIMESTAMPADD
is a JDBC escaped function and is accessible only by using the
JDBC escape function syntax.
TIMESTAMPADD( interval, integerExpression, timestampExpression )
To perform
TIMESTAMPADD
on dates and times, it is necessary to convert the dates
and times to timestamps. Dates are converted to timestamps by putting 00:00:00.0 in
the time-of-day fields. Times are converted to timestamps by putting the current date
in the date fields.
Do not put a datetime column inside a timestamp arithmetic function in WHERE
clauses, because the optimizer will not use any index on the column.
TIMESTAMPDIFF