Extraction function

An extraction (extraction_function) is a function that extracts parts of a date value, time value, or time stamp value or that calculates a date, time, or time stamp value.

Syntax

<extraction_function> ::=
  DATE        ( <expression> )
DAY         ( <date_or_timestamp_expression> )
HOUR        ( <time_or_timestamp_expression> )
MICROSECOND ( <expression> )
MINUTE      ( <time_or_timestamp_expression> )
MONTH       ( <date_or_timestamp_expression> )
SECOND      ( <time_or_timestamp_expression> )
TIME        ( <expression> )
TIMESTAMP   ( <expression>[, <expression> ] )
YEAR        ( <date_or_timestamp_expression> )

<date_or_timestamp_expression> ::= <expression>

<time_or_timestamp_expression> ::= <expression>

Examples

SQL Tutorial, Date and Time Calculations

Explanation

When used in a function, the argument date_or_timestamp_expression must supply a date, a time stamp, or an alphanumeric value that matches the current date or time stamp format.

When used in a function, the argument time_or_timestamp_expression must supply a time, a time stamp value, or an alphanumeric value that matches the current time or time stamp format.

Date and time values are available in a variety of date and time formats (ISO, USA, EUR, JIS, INTERNAL).

See also:

Functions: Overview