# Date\_time\_parse\_exception - Elasticsearch version 7.3.2

**URL:** https://discuss.elastic.co/t/date-time-parse-exception-elasticsearch-version-7-3-2/202652
**Category:** Elasticsearch
**Created:** [October 8, 2019, 11:26am UTC](https://discuss.elastic.co/t/date-time-parse-exception-elasticsearch-version-7-3-2/202652 "2019-10-08T11:26:08Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![lmariselvam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lmariselvam/32/54542_2.png) [@lmariselvam](https://discuss.elastic.co/u/lmariselvam)
#### Post date: [October 8, 2019, 11:26am UTC](https://discuss.elastic.co/t/date-time-parse-exception-elasticsearch-version-7-3-2/202652/1 "2019-10-08T11:26:08Z")

</div>

I have the mapping defined for "timestamp" field on ES as follows:  
`"timestamp": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss Z" }`  
and I'm trying to index the following document,  
`{ "account":"170/170/78202", "timestamp":"2019-10-06T10:52:09-04:00" }`

But getting exception as "failed to parse date field [2019-10-06T10:52:09-04:00] with format [yyyy-MM-dd HH:mm:ss Z]". In ES version 6.7, it worked well, but in 7.3.2, it doesn't work. Do we need to change in the way we index the date type values or need to adjust the mapping we defined in the index?

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [October 8, 2019, 12:00pm UTC](https://discuss.elastic.co/t/date-time-parse-exception-elasticsearch-version-7-3-2/202652/2 "2019-10-08T12:00:53Z")

</div>

This does not work under 6.8 either, as you time format does not match the date.

The `format` does not mention a `T` but a whitespace between date and time and also there is no whitespace between the time and the timezone, which is expected in the mapping format.

---

<div class="post-metadata">

### Author: ![lmariselvam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lmariselvam/32/54542_2.png) [@lmariselvam](https://discuss.elastic.co/u/lmariselvam)
#### Post date: [October 8, 2019, 12:34pm UTC](https://discuss.elastic.co/t/date-time-parse-exception-elasticsearch-version-7-3-2/202652/3 "2019-10-08T12:34:26Z")

</div>

@spinscale, even with the following format, it throws the same error  
`'{"account":"170/170/78202","timestamp":"2019-10-06 10:52:09 -04:00"}'`

`failed to parse date field [2019-10-06 10:52:09 -04:00] with f ormat [yyyy-MM-dd HH:mm:ss Z]'

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [October 8, 2019, 12:49pm UTC](https://discuss.elastic.co/t/date-time-parse-exception-elasticsearch-version-7-3-2/202652/4 "2019-10-08T12:49:58Z")

</div>

This is due to the switch from joda to java time with regards to parsing. Try using `XXX` as the timezone and make sure you read the java time docs for proper formatter definition at [https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html) (and not the joda ones)

---

<div class="post-metadata">

### Author: ![lmariselvam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lmariselvam/32/54542_2.png) [@lmariselvam](https://discuss.elastic.co/u/lmariselvam)
#### Post date: [October 8, 2019, 4:13pm UTC](https://discuss.elastic.co/t/date-time-parse-exception-elasticsearch-version-7-3-2/202652/5 "2019-10-08T16:13:41Z")

</div>

The problem was with the colon( : ) in the timezone value. I've removed that and it worked.  
`'{"account":"170/170/78202","timestamp":"2019-10-06 10:52:09 -0400"}'`

---

<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: [November 5, 2019, 4:13pm UTC](https://discuss.elastic.co/t/date-time-parse-exception-elasticsearch-version-7-3-2/202652/6 "2019-11-05T16:13:43Z")

</div>

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