0

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 )

1 Answer 1

2
 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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.