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

**URL:** <https://forum.knime.com/t/extract-date-yyyy-mm-dd-from-datetime-column-yyyy-mm-dd-hhss/71139>\
**Category:** KNIME Analytics Platform\
**Created:** [July 27, 2023, 7:18am UTC](https://forum.knime.com/t/extract-date-yyyy-mm-dd-from-datetime-column-yyyy-mm-dd-hhss/71139 "2023-07-27T07:18:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinay1995](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/v/e56c9b/32.png) [@Vinay1995](https://forum.knime.com/u/Vinay1995)\
**Post date:** [July 27, 2023, 7:18am UTC](https://forum.knime.com/t/extract-date-yyyy-mm-dd-from-datetime-column-yyyy-mm-dd-hhss/71139/1 "2023-07-27T07:18:25Z")

</div>

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](https://forum-cdn.knime.com/uploads/default/original/3X/4/c/4c1c579c3318001d97c291e74992a6ff562eff77.png)  
output result should be in new column with YYYY-MM-DD format

---

<div class="post-metadata">

**Author:** ![sanket\_2012](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@sanket\_2012](https://forum.knime.com/u/sanket_2012)\
**Post date:** [July 27, 2023, 7:34am UTC](https://forum.knime.com/t/extract-date-yyyy-mm-dd-from-datetime-column-yyyy-mm-dd-hhss/71139/2 "2023-07-27T07:34:47Z")

</div>

Hi @Vinay1995 ,  
You can try to use this [Modify Time](https://hub.knime.com/knime/extensions/org.knime.features.base/latest/org.knime.time.node.manipulate.modifytime.ModifyTimeNodeFactory) 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

---

<div class="post-metadata">

**Author:** ![takbb](https://forum-cdn.knime.com/user_avatar/forum.knime.com/takbb/32/57077_2.png) [@takbb](https://forum.knime.com/u/takbb)\
**Post date:** [July 27, 2023, 8:24am UTC](https://forum.knime.com/t/extract-date-yyyy-mm-dd-from-datetime-column-yyyy-mm-dd-hhss/71139/3 "2023-07-27T08:24:42Z")

</div>

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

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/4/8/48e5ba532e8d49dac0c4e9606c133bafd712085a.png)

[Manipulating timestamp to separate date and time.knwf](https://forum.knime.com/uploads/short-url/gCTJQye8YYBkVwuoyN7dfJ3kIiD.knwf) (22.4 KB)

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [October 25, 2023, 8:24am UTC](https://forum.knime.com/t/extract-date-yyyy-mm-dd-from-datetime-column-yyyy-mm-dd-hhss/71139/4 "2023-10-25T08:24:57Z")

</div>

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