Help Please String to Date & Time

From my file reader output, the string says: 1/12/2017
I went on to use the String to Date & Time node to convert the string variable to date.

I used this format: d/M/yyyy

However, the output of the String to Date & Time Node is this: 2017-12-1
It’s backwards and there are dashes instead of slashes.

Welcome to the forum @oksdojvs

You used the appropriate format for the string conversion.

In KNIME the Date&Time format is yyyy-MM-dd. Whatever you read into KNIME will be converted to this format when you transform it into Date&Time cells.

4 Likes

Thanks for the reply. But why does the Date and Time node change the slashes into dashes though. And just curious, is there no way to display the date as d/M/yyyy?

Like I said, the KNIME Date&Time format is yyyy-MM-dd. As far as I know, there is no way to change this and keep it as a Date&Time format.

The Date&Time format is a standard format so that KNIME can understand and manipulate dates and times. The specifics of slashes vs dashes and dmy vs mdy are human-readable points that (at least to me) don’t really matter. If you want to officially know why this route was chosen, you’ll have to ask the developers.

You can extract the Date&Time fields with the similarly named node and then do some manipulations to create whatever “date” format you’d like, but the result will be a String, not Date&Time.

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