# Date format failing on some docs

**URL:** https://discuss.elastic.co/t/date-format-failing-on-some-docs/10491
**Category:** Elasticsearch
**Created:** [January 24, 2013, 4:23pm UTC](https://discuss.elastic.co/t/date-format-failing-on-some-docs/10491 "2013-01-24T16:23:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![JP\_Toto](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jp_toto/32/2512_2.png) [@JP\_Toto](https://discuss.elastic.co/u/JP_Toto)
#### Post date: [January 24, 2013, 4:23pm UTC](https://discuss.elastic.co/t/date-format-failing-on-some-docs/10491/1 "2013-01-24T16:23:13Z")

</div>

Hey all!

Having a weird issue with the \_river failing to insert docs from Couchdb.

We have docs and specify the date format like:

"ReceivedAt": {  
"type": "date",  
"format":  
"yyyy-MM-dd'T'HH:mm:ss.SSSSSSSZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd  
HH:mm:ss.SSSSSS||yyyy-MM-dd HH:mm:ss"  
},

When we encounter dates like "FieldName": "2013-01-24T10:08:22-05:00", it  
fails but when we encouter dates like "FieldName":  
"2013-01-24T10:09:48.989-05:00", we can parse it ok. I thought we had both  
those formats covered in our schema format but perhaps not? Does the  
ordering matter in the format?

Thanks for any advice!

--

---

<div class="post-metadata">

### Author: ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)
#### Post date: [January 29, 2013, 9:03am UTC](https://discuss.elastic.co/t/date-format-failing-on-some-docs/10491/2 "2013-01-29T09:03:24Z")

</div>

Hi,

I think the issue here is that you have your Z enclosed in quotes for the  
failing date format:

yyyy-MM-dd'T'HH:mm:ss'Z'

It should work if you remove the quotes around Z.

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

On Thu, Jan 24, 2013 at 6:23 PM, JP Toto [james.p.toto@gmail.com](mailto:james.p.toto@gmail.com) wrote:

> Hey all!
> 
> Having a weird issue with the \_river failing to insert docs from Couchdb.
> 
> We have docs and specify the date format like:
> 
> "ReceivedAt": {  
> "type": "date",  
> "format":  
> "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ||yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'||yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd  
> HH:mm:ss.SSSSSS||yyyy-MM-dd HH:mm:ss"  
> },
> 
> When we encounter dates like "FieldName": "2013-01-24T10:08:22-05:00", it  
> fails but when we encouter dates like "FieldName":  
> "2013-01-24T10:09:48.989-05:00", we can parse it ok. I thought we had both  
> those formats covered in our schema format but perhaps not? Does the  
> ordering matter in the format?
> 
> Thanks for any advice!
> 
> --

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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: [July 6, 2017, 2:54am UTC](https://discuss.elastic.co/t/date-format-failing-on-some-docs/10491/3 "2017-07-06T02:54:14Z")

</div>


