EXTRACT Day / Month / Year from Date or Timestamp Column in Google Bigquery

In the following example, EXTRACT returns a value corresponding to the DAY time part.

SELECT EXTRACT(DAY FROM DATE '2013-12-25') as the_day;
+---------+
| the_day |
+---------+
| 25 |
+---------+

Other examples:

SELECT EXTRACT(MONTH FROM DATE '2013-12-25') as the_MONTH;
SELECT EXTRACT(YEAR FROM DATE '2013-12-25') as the_YEAR;
SELECT EXTRACT(WEEK FROM DATE '2013-12-25') as the_WEEK;
SELECT EXTRACT(QUARTER FROM DATE '2013-12-25') as the_QUARTER;

nVector

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