remove characters using string manipulation node and change string to date&time

1983-04-04T00:00:00

  1. I have a CSV file that has a column with dates that always have T00:00:00 behind it eg.
    1983-04-04T00:00:00
    1983-04-05T00:00:00

  2. After using CSV reader node, the column is String

I tried to use String manipulation node to replace or remove the T00:00:00 to no success.

Despite using google bard i still have no success. Please help me.

  1. I then want to change the data type to Date

Please help me. I tried and tried.

Hi @Needpractice

There are multiple ways to remove the time from your data/time input.
E.g. take the Cell Splitter node and use the “T” as the delimiter

image

You can use a String Manipulation node, and create s substring

substr($input$,0 ,10 )

next you have te String to Dat&Time node.

gr. Hans

3 Likes

Dear HansS,
Thank you so much.

I am still curious:
If my data was
(data type S ie string)
1983-04-04T00:00:00
1983-05-02T00:00:00
why does
replace(“1983-04-04T00:00:00”,“T”,“”) result in a new column where it was all 1983-04-0400:00:00
I am using the latest version of Knime

Dear HansS,
It worked… Why is it so easy to Knime experts… Thank you so much. 2 hours of scratching head and desperately trying to recall python is solved in 5 min.

So grateful. Thank you so very much

2 Likes

Hi @Needpractice ,

Glad I could help you out. Please mark the post as the solution with the :white_check_mark: when you get around to it. It helps point future user’s searches toward correct answers to their questions, and helps forum admins to avoid questions slipping through the cracks and going unanswered.

2 Likes

Just to add here for future reference
There is a Modify Time Node in KNIME which can remove time from dates. Maybe also a feasible option in certain situations
br

1 Like

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