# Date range query - 29 of February in "MMdd" format issue

**URL:** <https://discuss.elastic.co/t/date-range-query-29-of-february-in-mmdd-format-issue/115681>\
**Category:** Elasticsearch\
**Created:** [January 16, 2018, 10:20am UTC](https://discuss.elastic.co/t/date-range-query-29-of-february-in-mmdd-format-issue/115681 "2018-01-16T10:20:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nejra](https://avatars.discourse-cdn.com/v4/letter/n/8dc957/32.png) [@nejra](https://discuss.elastic.co/u/nejra)\
**Post date:** [January 16, 2018, 10:20am UTC](https://discuss.elastic.co/t/date-range-query-29-of-february-in-mmdd-format-issue/115681/1 "2018-01-16T10:20:19Z")

</div>

I encountered a difficulty when trying to query on  
"field\_name": {  
"type": "date",  
"format": "MMdd"  
}  
field. It happened for "0229" date and I got message "failed to parse date field [0229] with format [MMdd]". What shall I do considering 29 of February a valid date for leap years.

---

<div class="post-metadata">

**Author:** ![Mojster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mojster/32/21209_2.png) [@Mojster](https://discuss.elastic.co/u/Mojster)\
**Post date:** [January 16, 2018, 10:31am UTC](https://discuss.elastic.co/t/date-range-query-29-of-february-in-mmdd-format-issue/115681/2 "2018-01-16T10:31:19Z")

</div>

I you don't use a year, than the current is suspected.  
But in 2018 there is no 29. 2..

Try using it with year, it should work.

---

<div class="post-metadata">

**Author:** ![nejra](https://avatars.discourse-cdn.com/v4/letter/n/8dc957/32.png) [@nejra](https://discuss.elastic.co/u/nejra)\
**Post date:** [January 16, 2018, 1:35pm UTC](https://discuss.elastic.co/t/date-range-query-29-of-february-in-mmdd-format-issue/115681/3 "2018-01-16T13:35:23Z")

</div>

Thanks @Mojster for your response.  
I'm aware that it would work if the year is added, but in my case it must not be year dependent.

---

<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 13, 2018, 1:35pm UTC](https://discuss.elastic.co/t/date-range-query-29-of-february-in-mmdd-format-issue/115681/4 "2018-02-13T13:35:32Z")

</div>

Closed on February 13, 2018, 1:35pm UTC

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