Home > OS >  convert string (4/14/2016 8:00:00 PM) to timestamp in Bigquery
convert string (4/14/2016 8:00:00 PM) to timestamp in Bigquery

Time:10-23

Could you please help to convert String to DateTime in Bigquery? The length of String are different below, cause there's no 0 in a single number of date month, hour.

4/14/2016 8:00:00 PM

5/7/2016 5:00:00 P

I try to use PARSE_TIMESTAMP function but error "Failed to parse input string "4/14/2016 8:00:00 PM""

CodePudding user response:

Use below

select parse_timestamp('%m/%d/%Y %r', col) ts       

if applied to sample data in your question - output is

enter image description here

  • Related