Date format in csv can not be recognize

I received a data export in CSV.
The date time structure is a bit strange.
I just need a date and time I don’t care.
The format here is
04JUN21: 11: 17: 16

I chose the first 7 characters of 04JUN21 to convert them via string to date & time to date.
Unfortunately, NODE can’t recognize it. Can you explain that to me?


Knime forum data format.knwf (42.9 KB)

I enclose the workflow.

Hi @MarekV , the MMM format recognizes the capitalized version of what you have. So Jun instead of JUN, and Nov instead of NOV.

Just convert the month to Capitalized via the capitalize() function in the String Manipulation.

Here’s further details:

1 Like

First, look at the node error message:
image

Ok, now we check the message in the missing cells:
image

Index 2 is where NOV starts, so that’s a hint as to what’s going wrong.

Your inputted Date format is ddMMMyy, however, the node description says:

MMM matches short month names like “Jan”

The String to Date&Time node is quite strict about case; you cannot use MMM to try to match an all uppercase short month name.

The solution is to either

  1. convert the month names into the appropriate case using a string manipulation node and the code
    join(substr($crdateD$,0,2),capitalize(substr($crdateD$,2,3)),substr($crdateD$,5,2))
    or
  2. use the String to Date/Time (legacy) node, which is less strict about case.
3 Likes

Hello , thank you very much .
I am little bit confused but now I will some how follow your recommendation .
I have raised ticket because I had problem with date but in Italian format .https://forum.knime.com/t/problem-with-string-to-datetime-node-country-specific/41102
Recommendation was name of month has to be lower case “DIC” to “dic” not to “Dic”. I think this is country specific recognition . I used Case Converter and was ok. See workflow in my previous ticket .
For case above its is different approach
But thank you.

The root cause for that confusion is how Java parses the strings, it’s not a KNIME issue. KNIME AP version 4.4 onwards uses a different Java version. Maybe you can try to use the legacy mode mentioned here:

No promises though, as that thread is about capitalistion of AM/PM in different locales.

A bit more info:

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