Scalar function
Aliases: date_part
Returns NULL for a NULL date or timestamp. The field must be a non-NULL constant; an unknown field raises an error.
Syntax
Arguments
Returns
- Type: INTEGER for ordinary fields; BIGINT for EPOCH
- NULL behavior: Returns NULL for a NULL date or timestamp. The field must be a non-NULL constant; an unknown field raises an error.
Properties
Usage notes
- EPOCH returns BIGINT. Other fields return INTEGER.
- DOW is Sunday=1 through Saturday=7; ISODOW is Monday=1 through Sunday=7.
- Alternate year, month, week, and day names are accepted as listed above. ISO week-year fields use ISO week numbering.
- 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.
- EXTRACT uses
EXTRACT(unit FROM value) syntax. DATE_PART and DATEPART use a STRING field argument; their reported result types can differ.
- CENTURY and DECADE are not supported. Choose a field that applies to the input type; a field valid for DATE may not apply to TIME, TIMESTAMP, or INTERVAL.
Examples
Limitations
- Query tools report BIGINT for DATE_PART and DATEPART. EPOCH returns BIGINT; other fields return INTEGER.
- Use a STRING literal for the field name. Some STRING representations can return Sunday = 0 for DOW and a floating-point EPOCH value instead of the numbering and type described above.
Last modified on October 15, 2026