String to Date&Time - no suitable format

Hi KNIMErs,

I am having some trouble with the string to date&time node. I have dates that are in a British format that I need to use dd/mm/yyyy. KNIME does not find a suitable format (see pic) and when I try to enter dd/mm/yyyy in the date format for it to work with it does not work.

What am I doing wrong? Is there any way to work with dates in this format?

I was not expecting a problem with this. I have another column with dates in a similar format except sometimes it is dd/mm/yyyy, and sometimes it is either d/m/yy, dd/m/yy, or dd/mm/yy. Not looking forward to working with that one since what I thought would be easy is not working for me.

I appreciate all the help, the people on the forum are awesome!

Try


it guess format automatically. It returns only lines with dates.

Try using dd/MM/yyyy - note the capital M. I just tried this and it seems to work fine.

1 Like

I do not think Date Extractor works for this use case. It never guesses the British format dd/mm/yyyy when the US format mm/dd/yyyy is possible.

It does however handle the single digit dates, e.g., 5/2/2019, albeit wrongly in this case as it assumes that means May 2nd instead of February 5th. Is there some way to force it to stay on the British format?

Here is a screenshot if that didnt make sense.
image

@ScottF, dd/MM/yyyy works when all digits are there, but not when zeros are missing.

Do you know if there are any ways to use date formats when February 5th, 2019 is represented as 5/2/2019?

It seems like there has to be without getting into a regex, but I cannot figure it out.

Ah, in that case, try d/M/yyyy instead. This should parse both types of inputs correctly (e.g., 31/12/2018 and 5/2/2019).

Sorry for the trouble. We need to update the node description to make this usage a little more clear.

4 Likes

Holy cow, now it works! I swear I did that exact format after your first comment and couldn’t get it to work.

2 Likes

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