Background documentationExtraction (extraction_function) Locate this document in the navigation structure

 

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

Structure

Syntax Syntax

  1. <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>
End of the code.
Examples

SQL Tutorial, Date and Time Calculations

Explanation

When used in a function, the argument date_or_timestamp_expression must supply a date, time stamp or 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, time stamp or 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)

More Information

Functions: Overview