H2 DB - Strange problem with PARSEDATETIME on different systems

Viewed 38

I'm trying to parse a timestamp in an H2 DB with format 4/24/2022 6:03:30 pm using PARSEDATETIME.

PARSEDATETIME(created, 'M/d/yyyy h:mm:ss a')

It works like a charm on my computer.

However, if it is run on the computer of a client, it results in the following error message:

org.h2.jdbc.JdbcSQLDataException: Error parsing "4/24/2022 6:03:30 pm";

Caused by: java.time.format.DateTimeParseException: Text '4/24/2022 6:03:30 pm' could not be parsed at index 18

Any ideas what causes this problem - and more importantly, any suggestions how to solve this? Thanks in advance!

1 Answers
PARSEDATETIME(created, 'M/d/yyyy h:mm:ss a', 'en')

AM/PM are English (okay Latin) abbreviations. So add the locale 'en' as parameter.

Related