# Date format issue MMM D, YYYY h:mm:ss A

**URL:** <https://discuss.elastic.co/t/date-format-issue-mmm-d-yyyy-hss-a/162851>\
**Category:** Elasticsearch\
**Created:** [January 3, 2019, 5:02pm UTC](https://discuss.elastic.co/t/date-format-issue-mmm-d-yyyy-hss-a/162851 "2019-01-03T17:02:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajashree\_Gr](https://avatars.discourse-cdn.com/v4/letter/r/c4cdca/32.png) [@Rajashree\_Gr](https://discuss.elastic.co/u/Rajashree_Gr)\
**Post date:** [January 3, 2019, 5:02pm UTC](https://discuss.elastic.co/t/date-format-issue-mmm-d-yyyy-hss-a/162851/1 "2019-01-03T17:02:19Z")

</div>

I'm facing the org.elasticsearch.index.mapper.MapperParsingException: failed to parse [date] - exception while loading the data to elastic search.

The date format used is a date: MMM D, YYYY h:mm:ss A.  
The date value which I'm trying to load is Jan 3, 2019 4:34:34 PM.

I' not sure what is wrong here. I feel date input is exactly matching the format. But it is still failing.  
I also tried using date: default format but it is also giving the same exception.

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [January 3, 2019, 5:10pm UTC](https://discuss.elastic.co/t/date-format-issue-mmm-d-yyyy-hss-a/162851/2 "2019-01-03T17:10:13Z")

</div>

Please consult [https://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html](https://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html), referred here: [https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#custom-date-formats](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#custom-date-formats)

For example, you should be using `a` instead of `A` for the AM/PM

---

<div class="post-metadata">

**Author:** ![Rajashree\_Gr](https://avatars.discourse-cdn.com/v4/letter/r/c4cdca/32.png) [@Rajashree\_Gr](https://discuss.elastic.co/u/Rajashree_Gr)\
**Post date:** [January 3, 2019, 5:33pm UTC](https://discuss.elastic.co/t/date-format-issue-mmm-d-yyyy-hss-a/162851/3 "2019-01-03T17:33:40Z")

</div>

As i have AM/PM values in capital i used A instead a. When i verified this format in Kibana - date format pattern, it was giving me the date as expected. I will try it with 'a' instead of 'A' to see if it works.

I'm going through [https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#built-in-date-formats](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#built-in-date-formats). I think we should use strict date format always.

It is mentioned that - ' For instance a date like `5/11/1` would be considered invalid and would need to be rewritten to `2005/11/01` to be accepted by the date parser.' I will try this option as well to see if it works.

---

<div class="post-metadata">

**Author:** ![Rajashree\_Gr](https://avatars.discourse-cdn.com/v4/letter/r/c4cdca/32.png) [@Rajashree\_Gr](https://discuss.elastic.co/u/Rajashree_Gr)\
**Post date:** [January 5, 2019, 3:09am UTC](https://discuss.elastic.co/t/date-format-issue-mmm-d-yyyy-hss-a/162851/4 "2019-01-05T03:09:36Z")

</div>

I was able to format the date by referring to the website. I got the working date format YYYY-MM-DD'T'HH:mm:ss.SSS.

I'm trying to add the Zone name (like CST) to the above date format by adding z. But YYYY-MM-DD'T'HH:mm:ss.SSSz is not working and I tried many variations but none of them are working for me. I was able to get the zone offset by using 'Z' but not Zone name.  
Is the date format with zone name is not supported in elastic search?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 2, 2019, 3:09am UTC](https://discuss.elastic.co/t/date-format-issue-mmm-d-yyyy-hss-a/162851/5 "2019-02-02T03:09:37Z")

</div>

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