# Basic date time conversion

**URL:** <https://forum.knime.com/t/basic-date-time-conversion/26126>\
**Category:** KNIME Analytics Platform\
**Created:** [August 15, 2020, 10:59pm UTC](https://forum.knime.com/t/basic-date-time-conversion/26126 "2020-08-15T22:59:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![metaresolve](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/13edae/32.png) [@metaresolve](https://forum.knime.com/u/metaresolve)\
**Post date:** [August 15, 2020, 10:59pm UTC](https://forum.knime.com/t/basic-date-time-conversion/26126/1 "2020-08-15T22:59:44Z")

</div>

Hi,

My date is in the following format: “MM/DD/YYYY HH:MM” then AM or PM.

How do I translate that into a date/time field that I can work with? I’d like to make graphs.

Thanks,

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [August 16, 2020, 4:52am UTC](https://forum.knime.com/t/basic-date-time-conversion/26126/2 "2020-08-16T04:52:41Z")

</div>

You could first convert it to string and then use the

> **[String to Date&Time](https://hub.knime.com/knime/extensions/org.knime.features.base/latest/org.knime.time.node.convert.stringtodatetime.StringToDateTimeNodeFactory)**
>
> Parses the strings in the selected columns and converts them into Date&Time cells using the provided format pattern. Since dates may contain localized terms su…

Node and select the proper string pattern. If you want more operations with dates you could seek inspiration here:

[Various operations with dates as date value, string and number](https://kni.me/w/bbL30sJf7Hrt2I_4)

---

<div class="post-metadata">

**Author:** ![metaresolve](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/13edae/32.png) [@metaresolve](https://forum.knime.com/u/metaresolve)\
**Post date:** [August 16, 2020, 6:59am UTC](https://forum.knime.com/t/basic-date-time-conversion/26126/3 "2020-08-16T06:59:18Z")

</div>

My date format doesn’t appear in the en-US options. The example workflow you gave me chose a date format from de-DE. When I click Guess data type and format, it tells me “No suitable format found!”

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/8/2/8260a7e7c4ce63fc544b3b526ab3b98e07b795ca.png)

I tried putting in MM/DD/YYYY HH:MM but the node broke. Then, I tried using the String to Date/Time (legacy) node and putting the date format in there, but I came out with dates that were all in December when my dates were in April in the column I was trying to convert.

How do I convert the date-time format I have into something usable?

Thanks,

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [August 16, 2020, 7:27am UTC](https://forum.knime.com/t/basic-date-time-conversion/26126/4 "2020-08-16T07:27:00Z")

</div>

You might have to choose the format by hand and if this does not work to do additional conversions discussed here:

> [@Messy Date & Time String Reformatting](https://forum.knime.com/t/messy-date-time-string-reformatting/13222/3):
>
> Have you tried the string to Date/Time conversion with this format which should cover AM and PM dd/MM/yyyy hh.mm aa I think the node can also auto guess the right format. Also you can refer to.: [https://www.knime.com/blog/the-new-date-time-integration](https://www.knime.com/blog/the-new-date-time-integration) I am not at my trusted machine right now so I can’t test it.

> [@Extract time with PM/AM](https://forum.knime.com/t/extract-time-with-pm-am/18106/2):
>
> Hi, I think the format h:mm' 'a should work for you. Kind regards Alexander

> [@Parsing date time using string to date](https://forum.knime.com/t/parsing-date-time-using-string-to-date/19037/3):
>
> I changed the format to: dd/MM/yy hh:mm:ss a and now it seems to work We had a similar discussion before and I came up with a little bit of a messy solution. Maybe as an inspiration if further problems occur: [datetime\_test.knwf](https://forum-cdn.knime.com/uploads/default/original/2X/0/0566e05e6c13074c0487b6674c139469df1baf8a.knwf) (11.3 KB)

Maybe KNIME can improve the date and time nodes to handle these am/pm formats better.

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [August 16, 2020, 1:42pm UTC](https://forum.knime.com/t/basic-date-time-conversion/26126/5 "2020-08-16T13:42:44Z")

</div>

> [@metaresolve](#):
>
> I tried putting in MM/DD/YYYY HH:MM but the node broke.

This string does seem to do the trick:

> MM/dd/yyyy’ ‘hh:mm’ 'a

though I am not 100% happy with the AM/PM implementation.

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/1/2/12612fa194e6edd0dee666dc243f581448bf1dce.png)

> **[Deal with (messy) Time formats containing AM/PM distincions – mlauber71](https://hub.knime.com/mlauber71/spaces/Public/kn_example_date_time_am_pm_format~YAgylrhMQgyfgAyS/current-state)**
>
> Deal with (messy) Time formats containing AM/PM distincions

---

<div class="post-metadata">

**Author:** ![metaresolve](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/13edae/32.png) [@metaresolve](https://forum.knime.com/u/metaresolve)\
**Post date:** [August 16, 2020, 9:38pm UTC](https://forum.knime.com/t/basic-date-time-conversion/26126/6 "2020-08-16T21:38:52Z")

</div>

Thank you so much. A combination of those links got me to be able to convert the date into something I can use.

---

<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:** [February 15, 2021, 9:39am UTC](https://forum.knime.com/t/basic-date-time-conversion/26126/7 "2021-02-15T09:39:41Z")

</div>

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