22 Sep 19 · npack · #Bigquery ·   Bookmark   ×

How to get todays date / CURRENT_DATE in Google Bigquery

CURRENT_DATE returns the current date as of the specified or default timezone

SELECT CURRENT_DATE() as the_date;
+--------------+
| the_date |
+--------------+
| 2019-09-21 |
+--------------+

UNIX_DATE

Returns the number of days since 1970-01-01

Example:

SELECT UNIX_DATE(DATE "2008-12-25") as days_from_epoch;
+-----------------+
| days_from_epoch |
+-----------------+
| 14238 |
+-----------------+

npack

posted on 22 Sep 19

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds

Copied