Week date time functions

I have been reading this link https://rockset.com/docs/date-and-time-functions and and try to do a select to get a week of a date EXTRACT( week FROM TIMESTAMP_MILLIS(t.created) ) as semana but week does not exists.

For example

EXTRACT(
    year
    FROM
        TIMESTAMP_MILLIS(t.created)
) as annio

works but I do not how to get this data from a date time field.

Do you know how can I get this data?

Hi Jrios,

I believe you are looking for ISOWEEK as shown in this example:

SELECT EXTRACT(ISOWEEK FROM TIMESTAMP '2018-05-26 04:30:20.345Z')

This will give you the week number (1 - 52). If you want the day of the week number (1 - 7) then try DAYOFWEEK:

SELECT EXTRACT(DAYOFWEEK FROM TIMESTAMP '2018-05-26 04:30:20.345Z')

Let me know if that helps.

1 Like

Thanks, it is OK.

1 Like