A time function (time_function) is a function that is applied to time or time stamp values, or that supplies a time or time stamp value as a result.
<time_function> ::=
ADDTIME (
<time_or_timestamp_expression>, <time_expression> )
| MAKETIME (
<hours>, <minutes>, <seconds> )
| SUBTIME (
<time_or_timestamp_expression>, <time_expression> )
| TIMEDIFF (
<time_or_timestamp_expression>, <time_or_timestamp_expression>
)
<time_or_timestamp_expression> ::= <expression>
<time_expression> ::= <expression>
<hours> ::= <expression>
<minutes> ::= <expression>
<seconds> ::= <expression>
SQL Tutorial, Date and Time Calculations
When used in a function, the argument time_or_timestamp_expression must supply a time value, a time stamp value, or an alphanumeric value that matches the current time or time stamp format.
In a function, the argument time_expression must supply a time value or an alphanumeric value that is in the current time format.
When used in a function, each of the arguments hours, minutes or seconds must be an integer greater than or equal to 0. If an expression is not an integer, decimal places are truncated.
Date and time values are available in a variety of date and time formats (ISO, USA, EUR, JIS, INTERNAL).
In the ISO and USA
formats, the hours are displayed modulo 24.
In the EUR and JIS formats, a number of hours greater than 99 causes an
error.
In the format INTERNAL, you can specify hours up to 9999.
See also: