Extracts the month number (from 1 to 12) for a given date or timestamp.
Last updated 2 years ago
Was this helpful?
date_timestamp_expression: A DATE or TIMESTAMP expression.
DATE
TIMESTAMP
Examples
SELECT EXTRACT(MONTH FROM TIMESTAMP '2019-08-12 01:00:00.123456') -- 8
SELECT EXTRACT(MONTH FROM DATE '2019-08-12') -- 8
SELECT EXTRACT(MONTH FROM CAST('2019-08-12 01:00:00' AS TIMESTAMP)) -- 8
This function uses the function. When using the function, timestamps containing milliseconds are not allowed.
EXTRACT
CAST