# Aggreation values with date time

**URL:** <https://discuss.elastic.co/t/aggreation-values-with-date-time/16518>\
**Category:** Elasticsearch\
**Created:** [March 21, 2014, 8:43am UTC](https://discuss.elastic.co/t/aggreation-values-with-date-time/16518 "2014-03-21T08:43:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bagui](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bagui/32/960_2.png) [@bagui](https://discuss.elastic.co/u/bagui)\
**Post date:** [March 21, 2014, 8:43am UTC](https://discuss.elastic.co/t/aggreation-values-with-date-time/16518/1 "2014-03-21T08:43:58Z")

</div>

Hi,

I'm using the below aggs for getting max, avg values from 2 data fields.  
But the result is coming in unix timeformat I guess. Can I get the result  
normal time format,

query==\>  
"aggs" : {  
"max\_time" : {  
"max" : {  
"script" : "doc['gi\_xdr\_info\_end\_time'].value -  
doc['gi\_xdr\_info\_start\_time'].value"  
}  
},...  
}

result ==\>

- "aggregations":{
  - "max\_time":{
    - "value":60000.0  
},

  - "min\_time":{
    - "value":0.0  
},

  - "avg\_time":{
    - "value":46666.666666666664  
}  
}

mapping ==\>

"call\_start\_time":{

- "type":"date",
- "format":"dateOptionalTime"

}

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/99d63453-b863-4954-9f0f-ec7ccfd522e2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/99d63453-b863-4954-9f0f-ec7ccfd522e2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![bagui](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bagui/32/960_2.png) [@bagui](https://discuss.elastic.co/u/bagui)\
**Post date:** [March 22, 2014, 6:34am UTC](https://discuss.elastic.co/t/aggreation-values-with-date-time/16518/2 "2014-03-22T06:34:18Z")

</div>

Hi,

Pls suggest...

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5980b416-4b2d-4fae-9eb7-73e333d13fa9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5980b416-4b2d-4fae-9eb7-73e333d13fa9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [March 24, 2014, 5:11pm UTC](https://discuss.elastic.co/t/aggreation-values-with-date-time/16518/3 "2014-03-24T17:11:02Z")

</div>

Unfortunately, this is not supported at the moment. The value that you get  
back is the milliseconds since epoch (1/1/1970) so that's how you can  
convert it back yourself if needed.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/dee9ce7d-78a2-4817-8232-c79ad34f8ea1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/dee9ce7d-78a2-4817-8232-c79ad34f8ea1%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:41am UTC](https://discuss.elastic.co/t/aggreation-values-with-date-time/16518/4 "2017-07-06T01:41:02Z")

</div>


