String to Date&Time

Hello Community,

String Columns in my Data set looks as follows 2021-06-01 09:44:58.710 +0200. Now I want to transform this field into a Date type, because time and timezone is not necessary.
I could use String Manipulation and then transform, but I thought just one Node would be faster.

I tried yyyy-MM-dd HH:mm:ss.SSSXXX’[‘VV’] without success, also some variations of the last part.

Maybe someone can help me out.

BR,
Sven

Hi Sven,

You should be able to accomplish this using a Column Expression tool (in the KNIME Expressions extension). You’ll need to make sure you set it to replace the string column and change the output to Local Date.

1 Like

I tried yyyy-MM-dd HH:mm:ss.SSSXXX’[‘VV’] without success, also some variations of the last part.

For future reference, when I use the String to Date&Time node the strings yyyy-MM-dd HH:mm:ss.SSS XXXX or yyyy-MM-dd HH:mm:ss.SSS Z seem to work for this conversion. The key is to take note of the resulting error messages that tell you where in the string the parsing error is located.

2 Likes

Hi @sforesti and hello @elsamuel,
thanks for your replies. Both Solutions work fine for me.
@elsamuel the message in the left corner was a bit confusing (no suitable format found).

br,
Sven

My question would be, is it really faster in one node? Not sure

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