1

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

1 Answers1

1

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  
Mikhail Berlyant
  • 165,386
  • 8
  • 154
  • 230
  • Yes it worked for me , Thanks for that :) New Issue - getting new error( String "Yes" is not converting to bool using cast ) any advise here ? – Harshith S H Jul 10 '20 at 10:10
  • @HarshithSH I suggest that you accept his answer and create another question for this new error – rmesteves Jul 10 '20 at 11:15