# ES 7.0 New Date Format

**URL:** https://discuss.elastic.co/t/es-7-0-new-date-format/219413
**Category:** Elasticsearch
**Created:** [February 14, 2020, 4:18pm UTC](https://discuss.elastic.co/t/es-7-0-new-date-format/219413 "2020-02-14T16:18:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ben-charles](https://avatars.discourse-cdn.com/v4/letter/b/9f8e36/32.png) [@ben-charles](https://discuss.elastic.co/u/ben-charles)
#### Post date: [February 14, 2020, 4:18pm UTC](https://discuss.elastic.co/t/es-7-0-new-date-format/219413/1 "2020-02-14T16:18:13Z")

</div>

We are currently upgrading from ES 6.8.2 to 7.0.0. We have date fields in our documents that are stored with the format  
`yyyy-MM-dd'T'HH:mm:ss.SSSZ`

However, since in ES 7.0 uses java.util.time instead of Joda based time package, I keep getting an error that ElasticSearch is unable to parse this field.

`Caused by: ElasticsearchParseException[failed to parse date field [1970-01-01T00:00:00.003Z] with format [epoch_millis||date_time||date_time_no_millis]:`

Based on this [answer](https://discuss.elastic.co/t/date-time-parse-exception-elasticsearch-version-7-3-2/202652) from a previous discussion, we should now use `XXX` instead of `Z` for timezones. However, the ElasticSearch date/time formatters at [https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html) still document using the `Z` format. Which one does ES actually use?

Furthermore, when migrating indices from 6.8.2 to 7.0, will the date fields in the documents also be updated to store the dates using `XXX` instead of `Z`?

Thanks!

---

<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: [February 16, 2020, 2:46pm UTC](https://discuss.elastic.co/t/es-7-0-new-date-format/219413/2 "2020-02-16T14:46:39Z")

</div>

> [@ben-charles](#):
>
> [epoch\_millis||date\_time||date\_time\_no\_millis]

@ben-charles, Based on the error reported, you could try either one of these formats:

1. epoch\_millis
2. date\_time (yyyy-MM-dd'T'HH:mm:ss.SSSZZ). Example: 2020-02-16T09:44:02.342-0400
3. date\_time\_no\_millis (yyyy-MM-dd'T'HH:mm:ssZZ). Example: 2020-02-16T09:44:02-0400

---

<div class="post-metadata">

### Author: ![ben-charles](https://avatars.discourse-cdn.com/v4/letter/b/9f8e36/32.png) [@ben-charles](https://discuss.elastic.co/u/ben-charles)
#### Post date: [February 17, 2020, 1:54pm UTC](https://discuss.elastic.co/t/es-7-0-new-date-format/219413/3 "2020-02-17T13:54:35Z")

</div>

@lmariselvam These are the formats I am trying to use. In the error message I posted, it shows that ES is failing to parse this datetime using the same 3 formats you listed.

The error message is:  
`ElasticsearchParseException[failed to parse date field [1970-01-01T00:00:00.003Z] with format [epoch_millis||date_time||date_time_no_millis]: [Text '1970-01-01T00:00:00.003Z' could not be parsed: Conflict found: Fields resolved to two different dates: -0001-01-01 1970-01-01]]; nested: DateTimeParseException[Text '1970-01-01T00:00:00.003Z' could not be parsed: Conflict found: Fields resolved to two different dates: -0001-01-01 1970-01-01]; nested: DateTimeException[Conflict found: Fields resolved to two different dates: -0001-01-01 1970-01-01]; `

I am not sure about the fields being resolved to two different dates. Any ideas?

---

<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: [February 18, 2020, 10:40am UTC](https://discuss.elastic.co/t/es-7-0-new-date-format/219413/4 "2020-02-18T10:40:28Z")

</div>

@ben-charles It looks the value you're trying to index is `1970-01-01T00:00:00.003Z`, Could you try to put the appropriate timezone value in the "Z" part such as `1970-01-01T00:00:00.003-0400` and index the record?

---

<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: [March 17, 2020, 10:40am UTC](https://discuss.elastic.co/t/es-7-0-new-date-format/219413/5 "2020-03-17T10:40:30Z")

</div>

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