Date format in KNIME + Column Splitter

I am trying to split the date column. Also Knime reads it as string. I need Knime to read it in Date format to apply filters on it

image

Hi @suseearun

If your date is in a string format already, I would go for the Cell Splitter node and split on th “T”.
Next you can convert your the date-string to a date format using the String to Date&Time node.

If you manage to read in the date colunmn already in a date format, you can use the Modify Time node and go for the bottom left option “remove time”.

To give an advice how to read in your data a sample dataset instead of a screenshot would be helpfull.

gr. Hans

2 Likes

Hi @suseearun ,

you could try to read as a date&time format directly using the transformation tab in e. g. the Excel Reader, see screenshot

Additionally there is also a String to Date&Time Node which converts texts into dates, see this example workflow:

2 Likes

Hello @suseearun ,

To convert String data Type to Date format use String to Date&Time Node.
This node Parses the strings in the selected columns and converts them into Date&Time cells.

Instead of using Column Splitter node you can use Extract Date&Time Fields Node.
This node Extracts the selected fields from a Local Date, Local Time, Local Date Time or Zoned Date Time column and appends their values as corresponding integer or string columns.

Extract Date&Time Fields Node will help you to effectively extract values for further operations.

1 Like

I did the ‘T’ in cell splitter, but it forms a new column. I need only the first part and anything after ‘T’ is not needed.

How to execute this in cell splitter node?

Yes, I tried to do this, but it throws error.

If you want to work with it as a ‘date’ (e. g. calculate time differences, months etc) afterwards I would strongly recommend to utilize the String to Date&Time node.

If all you need is the text part of it. e. g. 2024-03-28 as per your screenshot (row 1, column AD), then the split should work, just delete the unnecessary columns afterwards either with a Table Manipulator Node or a Column Filter Node.

Thank you all. It worked.

I did the cell splitter first and then deleted the other column.
changed string into date

1 Like

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