parseDate not working with PM marker

Comments

2 comments

  • Avatar
    Kevin Sumo

    Hi Jamie Gangestad,

    Within your format you'll want to change the hour designation from "HH" to "hh." Lowercase "hh" defines the hours are in am/pm (1-12) so should address the error you're seeing.

    | parseDate("08/03/2021 02:00:00 PM","MM/dd/yyyy hh:mm:ss a", "America/New_York" ) as ThisDateParseShouldWork 

    Uppercase "HH" designates that the parsed hour is in 24 hour format. (0-23) Since 02 in this format is always AM trying to define this as PM could be resulting in the error. You should also see a similar issue if in your first expression you change the time from 02 to 13.  
     

    0
    Comment actions Permalink
  • Avatar
    Jamie Gangestad

    Yes, the lower case "hh" did fix the problem. Thank you.

    0
    Comment actions Permalink

Please sign in to leave a comment.