1
votes

I'm looking for a way to convert dates to ISO Year Week (YYYYww).

I used to use the following in Postgres. Does something similar exist for BigQuery?

to_char( current_date() :: DATE, 'IYYYIW' )

The output should have a leading 0 for weeks when applicable.

Cheers,

1

1 Answers

1
votes

I have found the following solution:

SELECT FORMAT_DATE('%G%V', DATE '2020-01-15');

There is more related information in the official documentation.