# ES Sorting on datetimestamp

**URL:** <https://discuss.elastic.co/t/es-sorting-on-datetimestamp/253476>\
**Category:** Elasticsearch\
**Created:** [October 27, 2020, 5:51pm UTC](https://discuss.elastic.co/t/es-sorting-on-datetimestamp/253476 "2020-10-27T17:51:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit-Singh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amit-singh/32/77273_2.png) [@Amit-Singh](https://discuss.elastic.co/u/Amit-Singh)\
**Post date:** [October 27, 2020, 5:51pm UTC](https://discuss.elastic.co/t/es-sorting-on-datetimestamp/253476/1 "2020-10-27T17:51:21Z")

</div>

Hi Elasticsearch community,

I have a doubt/ask, I need to get the latest record from the hits based on a date timestamp column. The format of date time column i.e. 'time': 'Mon Oct 26 20:04:11 2020'

Kindly help me out here,  
I am using this but didn't work.  
"size": 1,  
"sort": { "time": "desc"},

Thanks !!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 27, 2020, 6:14pm UTC](https://discuss.elastic.co/t/es-sorting-on-datetimestamp/253476/2 "2020-10-27T18:14:02Z")

</div>

Welcome!

As long as your mapping is correct (and your field is a `date` datatype), this looks correct.

---

<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:** [November 24, 2020, 6:14pm UTC](https://discuss.elastic.co/t/es-sorting-on-datetimestamp/253476/3 "2020-11-24T18:14:12Z")

</div>

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