Extract Date (YYYY-MM-DD) from datetime column (YYYY-MM-DD, HH:MM:SS)

Hi Team,
I have one column which consist date along with timestamp. I want to replace this column with only date and remove that timestamp and store it into the new column
input column
image
output result should be in new column with YYYY-MM-DD format

Hi @Vinay1995 ,
You can try to use this Modify Time node using which you can remove the time.

You could also try to have a look at some of the example workflows related to it.

Thanks,
Sanket

2 Likes

Hi @Vinay1995 ,

When you said you wanted to remove the timestamp and store it in a new column, I wasn’t sure if you wanted to keep the milliseconds or just the hh:mm:ss (as per your post title)

In addition to @sanket_2012 's useful tip on using Modify Time, which can be used to strip the time portion off of a datetime column and return just a date column, Modify Date can be used to strip the date portion and return just a time column.

If you want to first duplicate the full original timestamp column (including both date and time), then you can easily do so with a Rule Engine.

If you want the time to lose the milliseconds from the timestamp, you could convert the whole timestamp to a String column, using Date&Time to String and then use two String to Date&Time nodes; one which converts the String to a Date and the other which converts the String to a Time.

The removal of milliseconds would occur in the Date&Time to String, if you specify the output format as yyyy-MM-dd'T'HH:mm:ss instead of yyyy-MM-dd'T'HH:mm:ss.SSS

Here are some examples of the above

Manipulating timestamp to separate date and time.knwf (22.4 KB)

2 Likes

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