String to Date Time conversion issue

Hi All,
Looking for some assistance with a conversion issue.
My data source has dates in the following format: 13/09/2020 12:00:00 AM
In the StringToDateTime node I am using the custom pattern of dd/MM/yyyy h:mm:ss a
Have also tried dd/MM/yyyy hh:mm:ss a
The error is saying Text could not be parsed at index 20.
The hour component is 1-12 and the date is for Australia so dd/MM

Welcome to the forum @maddogmayhem.

This is a strange problem. Your first pattern works for me with no issues:


Can you upload your data and worklfow? The character at index 20 is the “A” in “AM”, so maybe there’s something strange happening there, or with your Date format as typed.


Thanks elsamuel. I changed the locale from en-AU to en-US and it worked fine. I’m not sure why the locale matters here but it works.
Thanks again.

1 Like

Hi @maddogmayhem , I think the issue you were having is described here, where different locales require a different case for the AM/PM. It’s one of those cases with Java where I have a “what were they thinking?” moment.

I never understood why Java “cares” about the case used. It’s like the designers just wanted to make life difficult for us. It wouldn’t be so bad if we could just convert the whole date time string to upper or lower case, but it insists on mixed case which in my view is the worst design they could have come up with… but alas it is what it is…:wink:


Thanks takbb, that makes a lot of sense now. I made the date string lowercase and it works with en-AU locale.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.