DATE_PART

functionsupportedCore SQL functions

docs.snowflake.com ↗

Date & time functions

Extracts the specified date or time part from a date, time, or timestamp.

Syntax

DATE_PART( <date_or_time_part> , <date_interval_time_or_timestamp_expr> )
DATE_PART( <date_or_time_part> FROM <date_interval_time_or_timestamp_expr> )

Parameters

NameRequiredDescription
date_or_time_partrequiredThe unit of time. Must be one of the values listed in Supported date and time parts (for example, month). The value can be a string literal or can be unquoted (for example, 'month' or month). When date_or_time_part is week (or any of its variations), the output is controlled by the WEEK_START session parameter. When date_or_time_part is dayofweek or yearofweek (or any of their variations), the output is controlled by the WEEK_OF_YEAR_POLICY and WEEK_START session parameters. For more information, including examples, see Calendar weeks and weekdays.
date_interval_time_or_timestamp_exprrequiredA date, an interval, a time, or a timestamp, or an expression that can be evaluated to one of those data types.

Returns

Returns a value of NUMBER data type.

Usage notes

Referenced by