Do you have English set as the language in your application?
You may be using a different locale that doesn't know about AM or PM. When I swap my language over to Dutch parsing the date fails, but works in English.
I think this is what is happening in this case.
I think you need to double up some of those characters as they aren't always single characters. The following works for me.
parseDateTime('2/8/2024 6:28:56 AM','MM/dd/yyyy hh:mm:ss aa')
I hope this helps!
im having similair issue.
my error:
10:09:04 PM
Unparseable date: "10:09:04 PM"
Failed to evaluate expression, error occurred on line 1, character 1
parseDateTime($Time, 'HH:mm:ss aa')
it works fine with AM, but the PM trips up the parser
We recently started getting this error in code that was previously working.
We are using CommunityCommons.getOriginalValueAsString to check a date against an updated value. The retrieved date (as string) is Sun Aug 09 00:00:00 EDT 2015
When trying to parse using parseDateTime format 'EEE MMM dd hh:mm:ss z yyyy', the error occurs.
Again, this was working previously. We recently upgraded to 10.23.0, but this seems like basic functionality that should not be dependent or change between versions.