# How do i convert epoch millis time to date in ES using query?

**URL:** <https://discuss.elastic.co/t/how-do-i-convert-epoch-millis-time-to-date-in-es-using-query/26953>\
**Category:** Elasticsearch\
**Created:** [August 6, 2015, 8:39am UTC](https://discuss.elastic.co/t/how-do-i-convert-epoch-millis-time-to-date-in-es-using-query/26953 "2015-08-06T08:39:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RohanKumbhar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rohankumbhar/32/23649_2.png) [@RohanKumbhar](https://discuss.elastic.co/u/RohanKumbhar)\
**Post date:** [August 6, 2015, 8:39am UTC](https://discuss.elastic.co/t/how-do-i-convert-epoch-millis-time-to-date-in-es-using-query/26953/1 "2015-08-06T08:39:18Z")

</div>

Hi All,

I wanted to display the date\_histogram facet in human readable format but it gives me the time in epoch millis , is there any way where i can convert it to normal date in query?

Query which i have tried  
{  
"facets": {  
"0": {  
"date\_histogram": {  
"field": "DEPLOY\_TIME",  
"interval": "1d",  
"format': "dd-MM-yyyy"  
}  
}

but still above query giving me the date in epoch millis only (as shown below)  
facets: {  
0: {  
\_type: date\_histogram  
entries: [  
{  
time: 1390176000000  
count: 4  
}  
{  
time: 1391472000000  
count: 1  
}  
}

need your help here to convert to normal date through ES query only.

Thanks,  
Rohan

---

<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:** [August 6, 2015, 9:53am UTC](https://discuss.elastic.co/t/how-do-i-convert-epoch-millis-time-to-date-in-es-using-query/26953/2 "2015-08-06T09:53:49Z")

</div>

Use aggregation instead of facet and you will get it.

---

<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 5, 2017, 11:57pm UTC](https://discuss.elastic.co/t/how-do-i-convert-epoch-millis-time-to-date-in-es-using-query/26953/3 "2017-07-05T23:57:07Z")

</div>


