String to Date&Time worked on previous knime version but having issues with current version (4.4.1)

Hi there,

I had used the string to Date&Time conversion on the previous Knime version and it had worked without issue. However it is not working on the new version - please see configuration
→ String is set as date-month-year hour:minutes AM/PM


However I get the below error message now and I can’t figure what’s wrong with the setup
“ERROR String to Date&Time 4:18:265 Execute failed: Failed to parse date in row 'Row0: Text ‘16/09/2021 6:07 PM’ could not be parsed at index 16”

Would really appreciate any assistance

Hi @Sajith,

Have you tried using a lower case h to represent the hour?

Capital H is used in 24 hour format 0-23, whereas lower case h is used for 1-12 in am/pm format.

[Edit: I’ve just opened KNIME to try this, and in addition, the am/pm needs to be in lower case, so you may need to do a string manipulation prior to the String to Date&Time node to replace the AM/PM part of your data with am/pm.]

3 Likes

BUT… in spite of my previous reply you are right @Sajith !!

I was surprised about the case of the AM/PM, as I thought it should be upper case, so I just went and tried it in KNIME 4.3.4

Using the format mask dd/MM/yyyy h:mm a
KNIME 4.3.4, converts 16/09/2021 6:07 PM
KNIME 4.4.1 converts 16/09/2021 6:07 pm

They both complain about the opposite case.
(I was testing this using locale en-AU as per the screenshot. The result of other locales may vary I guess)

Likewise the “a” in the “Date & Time to String” nodes also convert using the different case above, meaning that it has consistently changed with the newer KNIME, and not a bug in the node, so this is a bit of a “gotcha”!

Looking into this further, this appears to be a change in Java regarding default locales. You can see it mentioned here:

https://bugs.openjdk.java.net/browse/JDK-8211985

Reading the above article, this is a change to java. I have just tried this, and you can make the newer KNIME behave the OLD way by adding the following line to the end of your KNIME.INI file (located in same folder as your KNIME executable):

-Djava.locale.providers=COMPAT,CLDR

Restart KNIME and it will once again convert AM/PM as before.

As I don’t have details of the further implications of the above modification with the above setting, I’d advise some caution here without seeing an official comment from the KNIME team. It’s possible this is mentioned in some release notes but I haven’t investigated further. Maybe this is one for @ipazin :wink: ?

8 Likes

Hello @takbb and @Sajith,

could be related to updated version of Eclipse and Java from version 4.4.0.

Br,
Ivan

4 Likes

Yes @ipazin, I think it’s a change in the jdk which the new version uses.

3 Likes

Thanks @takbb and @ipazin; the response was very insightful, really appreciate it.
I’ve applied the line ‘’-Djava.locale.providers=COMPAT,CLDR’ into the ini file and it seems to be working fine now, thanks @takbb.

I haven’t checked if there’s any impact to other workflows I have with slightly different formats, but it should be fine.

3 Likes

Hi Sajith
Good to see there is a fix, I have the same issue.
How/where did you put that line? I have the same issue, and unfortunately I’m don’t have the knowledge to do this level of tweaking.

Hi @rameog, there’s a file called knime.ini where you can enter the line - the file is located in the same folder as your knime executable (generally in the location - C:\Program Files\KNIME).

You can open the .ini file with notepad and enter the line right at the bottom of the file.

3 Likes

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