Background documentationTime Function (time_function) Locate this document in the navigation structure


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.


Syntax Syntax

  1. <time_function> ::=
    | MAKETIME(<hours>,<minutes>,<seconds>)
    | SUBTIME(<time_or_timestamp_expression>,<time_expression>)
    | TIMEDIFF(<time_or_timestamp_expression>,<time_or_timestamp_expression>)
    <time_or_timestamp_expression> ::=
    <time_expression> ::=
    <hours> ::=
    <minutes> ::=
    <seconds> ::=
End of the code.

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 matches 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 INTERNAL format, you can specify up to 9999 hours.

More Information

Functions: Overview