user2491463
user2491463

Reputation: 512

Bigquery converting string to timestamp

Whats the best way to convert a string value like this to a timestamp?

"2021-05-11T02:00:03.4897671"

I tried the below

select PARSE_TIMESTAMP("%Y-%m-%d %H:%M:%E#S", "2021-05-11T02:00:03.4897671")

But I get the following error

Failed to parse input string "2021-05-11T02:00:03.4897671"

Upvotes: 0

Views: 182

Answers (1)

Sergey Geron
Sergey Geron

Reputation: 10172

Try this:

select PARSE_TIMESTAMP("%Y-%m-%dT%H:%M:%E*S", "2021-05-11T02:00:03.4897671")

Upvotes: 1

Related Questions