Harshith S H
Harshith S H

Reputation: 13

How to insert string “dd/mm/yy hh:mm:ss” into datetime column in bigquery

I need to insert string “10/11/2019 12:34:45” into datetime column in bigquery , please advise any options ?

Upvotes: 1

Views: 2255

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 173190

Below is for BigQuery Standard SQL

you can use

PARSE_DATETIME('%d/%m/%Y %T', datetime_col_as_string) datetime_col_as_datetime    

for example, SELECT PARSE_DATETIME('%d/%m/%Y %T', '10/11/2019 12:34:45') produces datetime value as in below

Row datetime_col_as_datetime     
1   2019-11-10T12:34:45  

Upvotes: 1

Related Questions