Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Date function in standard SQL in Google bigquery

What are the date functions like (YEAR(), MONTH(), DATEADD(), DATEDIFF(),...) in standard SQL of Goolge bigquery?

I used functions here when --use_legacy_sql is true, but they don't work with standard SQL.

like image 995
Hajar Homayouni Avatar asked May 24 '26 07:05

Hajar Homayouni


1 Answers

You can find all Date functions for BigQuery Standard SQL here: https://cloud.google.com/bigquery/sql-reference/functions-and-operators#date-functions

Specifically EXTRACT returns the value corresponding to the specified date part. The part must be one of:

DAYOFWEEK (Returns 1-7, where 1=Sunday ... 7=Saturday)
DAY
DAYOFYEAR
MONTH
QUARTER (Returns 1-4)
YEAR

See also DATE_ADD, DATE_SUB, DATE_DIFF and rest for respectively DATEADD(), DATEDIFF() ...

like image 194
Mikhail Berlyant Avatar answered May 26 '26 21:05

Mikhail Berlyant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!