Reputation: 1
I have a string value as "5/10/2019 4:21:20 PM"
in one column, I have to convert into valid datetime to "2019-10-05T16:21:20"
.
We are using big query database.
I have tried with Date and timestamp functions but its throwing error as Invalid timestamp: "5/10/2019 4:21:20 PM"
Upvotes: 0
Views: 203
Reputation: 173190
Below is for BigQuery Standard SQL
SELECT PARSE_DATETIME('%d/%m/%Y %r', '5/10/2019 4:21:20 PM')
with result
2019-10-05T16:21:20
You can read more about Supported format elements for DATETIME
Upvotes: 2