Remove extra seconds from the data

I have data like-2019-09-13T09:25:02.0120682, now I want to convert like-2019-09-13 09:25:02(yyyy-MM-dd HH:mm:ss) , I know we can do it through date&Time String node , but this column is already string type,so what can be best approach to convert the data and we want to to apply this rule for around 6 columns together.

Good morning @analytics_sharma,

you might convert the string, if it isnÄt already of the type date time, to such via String to Date&Time node and then adjust it by one second via the Date&Time Shift node.

Kind regards
Mike

1 Like

Hi @analytics_sharma,

As @mw has suggested the String to Data&Time node can convert the string to Data&Time.

But if you want to keep the column type as string and only manipulate it to have your desired format then you can use the String Manipulation node with this expression:
regexReplace(regexReplace($column1$, "T", " "), "\\..*", "")

But since you have 6 columns to manipulate I suggest using the Column Expressions node or using a loop.

Here is an example for you:
date_string.knwf (27.3 KB)

:blush:

4 Likes

Thank You ,the solution is working as expected

1 Like

Hi there,

guess substr() function should work as well…

Br,
Ivan

2 Likes

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