Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

STRING to DATE in BIGQUERY

I am struggling trying to do this with Google BigQuery:

I do have a column with dates in this following STRING format:

6/9/2017   (M/D/YYYY) 

I am wondering how can I deal with this, trying to use then the DATE clause., in order to get the DATE format:

YYYY-MM-DD.

Thanks in advance.

like image 272
Lucasaudati11 Avatar asked Jun 15 '17 10:06

Lucasaudati11


People also ask

What is the date format in BigQuery?

The date in the format %m/%d/%y. The day of the month as a decimal number (01-31). The day of month as a decimal number (1-31); single digits are preceded by a space. The date in the format %Y-%m-%d.


Video Answer


1 Answers

Easy one, with standard SQL:

#standardSQL SELECT PARSE_DATE('%m/%d/%Y',  '6/22/2017')   2017-06-22   

https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#supported-format-elements-for-date

like image 193
Felipe Hoffa Avatar answered Oct 29 '22 00:10

Felipe Hoffa