Reputation: 3
I'm trying to use Pars_Timestamp function in Standard SQL and it parses with no differentiation between Am and PM below is my query and the result of both are the same which is not correct;
SELECT
PARSE_TIMESTAMP("%B %e, %Y %l:%M %p",time)
FROM (
SELECT
'May 14, 2018 9:46 AM' AS time
UNION ALL
SELECT
'May 14, 2018 9:46 PM' AS time )
Upvotes: 0
Views: 44
Reputation: 172944
PARSE_TIMESTAMP("%B %e, %Y %I:%M %p",time)
You can try it with your dummy data as
#standardSQL
SELECT
PARSE_TIMESTAMP("%B %e, %Y %I:%M %p",time)
FROM (
SELECT
'May 14, 2018 9:46 AM' AS time
UNION ALL
SELECT
'May 14, 2018 9:46 PM' AS time )
this will give you
05/14/2018 09:46:00
05/14/2018 21:46:00
Upvotes: 2