Skip to main content
Scalar function
NULL temporal input yields NULL. Unsupported unit/type combinations can raise errors.

Syntax

Calendar (scalar)

  • The unit must apply to the input type. Use one of the calendar or clock units listed above.

Arguments

Returns

  • Type: INTEGER
  • NULL behavior: NULL temporal input yields NULL. Unsupported unit/type combinations can raise errors.

Properties

Usage notes

  • EXTRACT uses a unit keyword and FROM: EXTRACT(unit FROM value). DATE_PART and DATEPART use a STRING field and comma-separated arguments. Their reported return types can differ.
  • With native execution, EXTRACT returns INTEGER. Java execution reports BIGINT and is outside this page’s scope.
  • YEAR and MONTH can handle some out-of-range UTC or timezone-free dates that other fields cannot. Other components remain limited to their supported calendar range.

Examples

Extract a year

Extract time fields

Limitations

  • Use the listed units. DECADE, CENTURY, and MILLENNIUM are outside this page’s supported forms.
  • EPOCH, DOW, and ISODOW have different numbering or return-type rules and are outside this form.
  • The parser accepts additional time-frame names and units; this form does not imply support for every such name.
Last modified on October 15, 2026