String to Date - No suitable format found!

Hello Community,

I have a CSV-File and all dates are imported as String in the format MM/dd/yyyy.
The String to Date Node is not able to convert the cell into suitable format (I tried to put the format manually, without success) and the Node failes. When I use the legacy Node, KNIME is able to convert the cell, but I’m not able use the Date Extraction Node.

any suggestions?

br,
Sven

Hi @sven-abx , you would have to show/give us some sample dates for us to see what the correct format should be.

2 Likes

hi @bruno29a,

currently the file looks like this:
image

but it is a String Column. It would be ok for me, if I could transform it to extract year, month, cw, day etc.

The String to Date Node delivers: ERROR String to Date&Time 0:9 Execute failed: Failed to parse date in row 'Row0: Text ‘4/28/2020’ could not be parsed at index 0

Maybe it is the enconding?
BR,
Sven

1 Like

Hi @sven-abx, some of your months and days are single digit so try using the format

M/d/yyyy

as single M and single d allow for both one and two digits whereas MM and dd mandate that they are always two digit with leading zero.

6 Likes

Hi @sven-abx , basically what you were using MM/dd/yyyy means 2 digits for month, 2 digits for day and 4 digits for year.

You can see from your data that it is not the case. For example, your 9/8/2018 shows that your date is formatted as M/d/yyyy. For it to be in the format of MM/dd/yyyy, this date would have to be as 09/08/2018.

So, the correct format for your dates is M/d/yyyy.

4 Likes

Hi @takbb and @bruno29a,

you are both right, I used m/d/yyyy now and it was working. Thank you very much!
All the time I was thinking, that some of the dates maybe need to be filtered, because of the string format.

Thanks for your help!

BR,
Sven

2 Likes

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