Datetime Functions
current_date
Returns the current date as of the start of the query.
Examples:
Supported Signatures
Note: current_date() is stable, i.e. might return a different value for a different query execution.
current_time
Returns the current time with time zone as of the start of the query.
Examples:
Supported Signatures
Note: current_time() is stable, i.e. might return a different value for a different query execution.
current_timestamp
Returns the current timestamp with time zone as of the start of the query, with 3 digits of subsecond precision,
Examples:
Supported Signatures
Note: current_timestamp() is stable, i.e. might return a different value for a different query execution.
date
This is an alias for CAST(x AS date).
Supported Signatures
date_diff
Takes a unit, timestamp1, and timestamp2. Returns timestamp2 - timestamp1 expressed in terms of unit.
Examples:
Supported Signatures
date_format
Formats timestamp as a string using format.
Examples:
Supported Signatures
date_parse
Parses string into a timestamp using format.
Supported Signatures
date_trunc
Returns x truncated to unit.
Supported Signatures
day
Returns the day of the month from x.
Examples:
Supported Signatures
day_of_month
This is an alias for day().
Supported Signatures
day_of_week
Returns the ISO day of the week from x. The value ranges from 1 (Monday) to 7 (Sunday).
Supported Signatures
day_of_year
Returns the day of the year from x. The value ranges from 1 to 366.
Supported Signatures
dow
This is an alias for day_of_week().
Supported Signatures
doy
This is an alias for day_of_year().
Supported Signatures
from_unixtime
Returns the UNIX timestamp unixtime as a timestamp with time zone. unixtime is the number of seconds since 1970-01-01 00.00.00 UTC.
Examples:
Supported Signatures
hour
Returns the hour of the day from x. The value ranges from 0 to 23.
Supported Signatures
localtimestamp
Returns the current timestamp as of the start of the query, with 3 digits of subsecond precision.
Supported Signatures
Note: localtimestamp() is stable, i.e. might return a different value for a different query execution.
millisecond
Returns the millisecond of the second from x.
Supported Signatures
minute
Returns the minute of the hour from x.
Supported Signatures
month
Returns the month of the year from x.
Examples:
Supported Signatures
now
This is an alias for current_timestamp.
Examples:
Supported Signatures
Note: now() is stable, i.e. might return a different value for a different query execution.
quarter
Returns the quarter of the year from x. The value ranges from 1 to 4.
Supported Signatures
second
Returns the second of the minute from x.
Supported Signatures
to_unixtime
Returns timestamp as a UNIX timestamp.
Examples:
Supported Signatures
year
Returns the year from x.
Examples:
Supported Signatures