# European and American date formats

**URL:** <https://discuss.elastic.co/t/european-and-american-date-formats/3244>\
**Category:** Elasticsearch\
**Created:** [August 23, 2010, 7:48am UTC](https://discuss.elastic.co/t/european-and-american-date-formats/3244 "2010-08-23T07:48:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lenak](https://avatars.discourse-cdn.com/v4/letter/l/96bed5/32.png) [@Lenak](https://discuss.elastic.co/u/Lenak)\
**Post date:** [August 23, 2010, 7:48am UTC](https://discuss.elastic.co/t/european-and-american-date-formats/3244/1 "2010-08-23T07:48:52Z")

</div>

Hello, Shay

How I can to define date format in mapping that allow me to search on a date field by range in European and American formats like  
[2010-08-11 TO 2010-08-30] or [08/11/2010 TO 08/30/2010]

I try to define date format like

"format":"yyyy-MM-dd||yyyy/MM/dd||MM/dd/yyyy"

But I got error when try to write document  
{"error":"ReplicationShardOperationFailedException[[111111][4] ]; nested: MapperParsingException[Failed to parse [case.d  
ate\_created]]; nested: IllegalArgumentException[Invalid format: "2010/10/10" is too short]; "}

$ curl -XPUT '[http://localhost:9200/111111/OBJ/2](http://localhost:9200/111111/OBJ/2)' -d '  
{  
"case" : {  
"title": "privet1",  
"date\_created" : "2010/10/10"  
}  
}'  
It is working after that I delete American format definition from formats and format  
"format":"yyyy-MM-dd||yyyy/MM/dd"

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [August 23, 2010, 8:11am UTC](https://discuss.elastic.co/t/european-and-american-date-formats/3244/2 "2010-08-23T08:11:45Z")

</div>

This should work, can you open an issue with a simpel curl recreation, I  
will look at this (in the middle of another feature).

-shay.banon

On Mon, Aug 23, 2010 at 10:48 AM, Lenak [lenakovganov@gmail.com](mailto:lenakovganov@gmail.com) wrote:

> Hello, Shay
> 
> How I can to define date format in mapping that allow me to search on a  
> date  
> field by range in European and American formats like  
> [2010-08-11 TO 2010-08-30] or [08/11/2010 TO 08/30/2010]
> 
> I try to define date format like
> 
> "format":"yyyy-MM-dd||yyyy/MM/dd||MM/dd/yyyy"
> 
> But I got error when try to write document  
> {"error":"ReplicationShardOperationFailedException[[111111][4] ]; nested:  
> MapperParsingException[Failed to parse [case.d  
> ate\_created]]; nested: IllegalArgumentException[Invalid format:  
> "2010/10/10" is too short]; "}
> 
> $ curl -XPUT '[http://localhost:9200/111111/OBJ/2](http://localhost:9200/111111/OBJ/2)' -d '  
> {  
> "case" : {  
> "title": "privet1",  
> "date\_created" : "2010/10/10"  
> }  
> }'  
> It is working after that I delete American format definition from formats  
> and format  
> "format":"yyyy-MM-dd||yyyy/MM/dd"
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/European-and-American-date-formats-tp1285438p1285438.html](http://elasticsearch-users.115913.n3.nabble.com/European-and-American-date-formats-tp1285438p1285438.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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, 4:20am UTC](https://discuss.elastic.co/t/european-and-american-date-formats/3244/3 "2017-07-06T04:20:27Z")

</div>

Closed on July 6, 2017, 4:20am UTC


