# string to date MMM dd, yyyy hh:mm\[:ss\[.sss\]\] a format not working

**URL:** <https://forum.knime.com/t/string-to-date-mmm-dd-yyyy-hh-mm-ss-sss-a-format-not-working/37736>\
**Category:** KNIME Analytics Platform\
**Created:** [December 1, 2021, 1:57pm UTC](https://forum.knime.com/t/string-to-date-mmm-dd-yyyy-hh-mm-ss-sss-a-format-not-working/37736 "2021-12-01T13:57:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlema](https://forum-cdn.knime.com/user_avatar/forum.knime.com/dlema/32/21457_2.png) [@dlema](https://forum.knime.com/u/dlema)\
**Post date:** [December 1, 2021, 1:57pm UTC](https://forum.knime.com/t/string-to-date-mmm-dd-yyyy-hh-mm-ss-sss-a-format-not-working/37736/1 "2021-12-01T13:57:52Z")

</div>

Hi:

I have a table with dates as text as in the following examples:

Nov 21, 2021 08:12:31 AM

I am trying to convert to datetime with String to Date&Time node providing the following format: ‘MMM dd, yyyy hh:mm[:ss[.sss]] a’ (without the colons) but it does not work. I tried capitalizing, uppercasing, and lowercasing the month and am/pm in all possible combinations, but none of them works.

Of course I can do it with a small java script, but my user’s community are not programmers and I need a non-coding solution.

Any idea on what’s happening?

---

<div class="post-metadata">

**Author:** ![Matt\_D](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/e495f1/32.png) [@Matt\_D](https://forum.knime.com/u/Matt_D)\
**Post date:** [December 1, 2021, 2:47pm UTC](https://forum.knime.com/t/string-to-date-mmm-dd-yyyy-hh-mm-ss-sss-a-format-not-working/37736/2 "2021-12-01T14:47:34Z")

</div>

Can not explain why but setting the locale to **en-US** and using **MMM dd, yyyy hh:mm[:ss[.SSS]] a** works.

---

<div class="post-metadata">

**Author:** ![ipazin](https://forum-cdn.knime.com/user_avatar/forum.knime.com/ipazin/32/806_2.png) [@ipazin](https://forum.knime.com/u/ipazin)\
**Post date:** [December 1, 2021, 3:59pm UTC](https://forum.knime.com/t/string-to-date-mmm-dd-yyyy-hh-mm-ss-sss-a-format-not-working/37736/3 "2021-12-01T15:59:07Z")

</div>

Hello @dlema and @Matt_D,

this is related to locale change in Java. See here for more:

> [@String to Date&Time worked on previous knime version but having issues with current version (4.4.1)](https://forum.knime.com/t/string-to-date-time-worked-on-previous-knime-version-but-having-issues-with-current-version-4-4-1/36507):
>
> Hi there, I had used the string to Date&Time conversion on the previous Knime version and it had worked without issue. However it is not working on the new version - please see configuration → String is set as date-month-year hour:minutes AM/PM However I get the below error message now and I can’t figure what’s wrong with the setup “ERROR String to Date&Time 4:18:265 Execute failed: Failed to parse date in row 'Row0: Text ‘16/09/2021 6:07 PM’ could not be parsed at index 16” W…

Br,  
Ivan

---

<div class="post-metadata">

**Author:** ![dlema](https://forum-cdn.knime.com/user_avatar/forum.knime.com/dlema/32/21457_2.png) [@dlema](https://forum.knime.com/u/dlema)\
**Post date:** [December 2, 2021, 2:27pm UTC](https://forum.knime.com/t/string-to-date-mmm-dd-yyyy-hh-mm-ss-sss-a-format-not-working/37736/4 "2021-12-02T14:27:20Z")

</div>

The issue is related to the combination of format and language. ‘MMM’ (three letter month names) and ‘a’ (AM/PM) works in English and other languages, but not in Spanish… It seems that the problem is that these date representations are not linguistically valid in Spanish (but people and legacy applications uses it anyway). Even in java java.time.format.DateTimeFormatter ‘MMM dd, yyyy hh:mm[:ss[.SSS]] a’ fails when locale is es\_XX (where XX is any of the spanish speeking countries).

At the end, I solved the problem using a java snippet node, (explained in [Conversión de Fechas Arbitrarias en Knime - YouTube](https://youtu.be/A-MwowPSsI0)), but that solution is not end-user friendly ← In fact, is easier to replace Spanish three letter month names into English and use string to date&time in English, that way, non-programmers can solve the issue.

---

<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:** [June 3, 2022, 2:27am UTC](https://forum.knime.com/t/string-to-date-mmm-dd-yyyy-hh-mm-ss-sss-a-format-not-working/37736/5 "2022-06-03T02:27:22Z")

</div>

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