Date format changed to yyyy-mm-dd from dd-mm-yyyy when using "string to date/time" node?

When converting string to date format using string to Date/Time node,the format for date column changed to yyyy-mm-dd from dd-mm-yyyy.

1 Like

check image for reference


Output:

OutputDate

Hi there!

String to Date&Time node converts string column type to Local Date Time column type (in your case to Local Date only cause you have no time part) for which yyyy-MM-dd is representation in KNIME. To check column representations in KNIME go File --> Preferences --> KNIME --> Preferred Renderers

If you use old (legacy) Time&Date format you can get something closer to your desired output but I would not recommend it as it will soon become depreciated…

Br,
Ivan

2 Likes

Hi ipazin,

Date & Time setting is already in dd.MMM.yyyy format only, check below image for reference. Do i need to change any setting here.
Preferred settings

1 Like

Hi,

The default and standard date and time format in KNIME follows ISO8601.
The “Date and Time” option in KNIME preferences that you have in the screenshot refers to the legacy format. To transform Date&Time to legacy Date&Time, use Date&Time to legacy Date&Time node.

Best,
Armin

3 Likes

Used Date&Time to legacy Date&Time node but the format changed as shown below
image
But i want same format which is in date string

1 Like

The options are these three formats:
dd.MMM.yyyy (MMM like Jul, Aug, …)
MM/dd/yyyy (US)
yyyy-MM-dd (ISO8601)

To work with date and time in KNIME I suggest that you keep the standard format in ISO8601 and when you want to export the table elsewhere in your desired format (dd-MM-yyyy) then change the format. That would be easy to be done in a String Manipulation node with this expression:
join(substr($column1$, 8,2), "-", substr($column1$, 5,2), "-", substr($column1$, 0,4))
Where “column1” is your date column.
This will change 2018-12-01 to 01-12-2018

Armin

5 Likes

Why? What is the use case that demands this format to be used with the internal date representation? As @armingrudd points out, you can convert it when you need it in that format and, presumably, you have converted it to internal format to manipulate it as a date rather than a text string.

1 Like

i have date column in other table which represents same format,so i want to have consistent look in the data for joining based on date column…
Please correct me if i am thinking wrongly

Hi threre!

But date column in other table is string then, isn’t it? Have both columns either String or either Date&Time but in same format for joining reasons.

Br,
Ivan

2 Likes

Yes ipazin, Date column in other table is string but it has to be in same format for joining reasons.

1 Like

Hi,

so you should have both columns as Date&Time in which case they will be same format and you will be able to join and additionally use Date&Time nodes/manipulations over them or you can have both columns string in which case you need to make them in same format if not already using String Manipulation node.

Br,
Ivan

2 Likes

Yes ipazin…

1 Like

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