I need to insert string “10/11/2019 12:34:45” into datetime column in bigquery , please advise any options ?
Asked
Active
Viewed 1,441 times
1
-
Does this answer your question? [STRING to DATE in BIGQUERY](https://stackoverflow.com/questions/44564887/string-to-date-in-bigquery) – Igor Jul 09 '20 at 19:01
-
Yes string to date , which function will work ? – Harshith S H Jul 09 '20 at 19:04
1 Answers
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