Extracts the week number (from 0 to 53) 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(WEEK FROM TIMESTAMP '2019-08-12 01:00:00.123456') -- 33
SELECT EXTRACT(WEEK FROM DATE '2019-08-12') -- 33.
SELECT EXTRACT(WEEK FROM CAST('2019-08-12 01:00:00' AS TIMESTAMP)) -- 33
This function uses the function. When using the function, timestamps containing milliseconds are not allowed.
EXTRACT
CAST