# Date sorting

**URL:** <https://discuss.elastic.co/t/date-sorting/109953>\
**Category:** Elasticsearch\
**Created:** [December 1, 2017, 3:09pm UTC](https://discuss.elastic.co/t/date-sorting/109953 "2017-12-01T15:09:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maarten\_Vandermeiren](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@Maarten\_Vandermeiren](https://discuss.elastic.co/u/Maarten_Vandermeiren)\
**Post date:** [December 1, 2017, 3:09pm UTC](https://discuss.elastic.co/t/date-sorting/109953/1 "2017-12-01T15:09:05Z")

</div>

Hello,

I have a question on sorting the result of a query on a date field.  
The dates I have are stored as longs (epoch\_millis).  
When I only sort on this date column I want the hours, minutes,... to be taken into account.

If I add another field to sort on. I want only the date part (dd-mm-yyyy) to be taken into account in my date sorting because the other field will sort my records with the same date.

Is there an option to do so with Elasticsearch.

I use Elasticsearch 2.4 with a dynamic mapping.

Many thanks!

Maarten

---

<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:** [December 29, 2017, 3:09pm UTC](https://discuss.elastic.co/t/date-sorting/109953/2 "2017-12-29T15:09:15Z")

</div>

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