# Extracting hour from date field (scripted field)

**URL:** <https://discuss.elastic.co/t/extracting-hour-from-date-field-scripted-field/691>\
**Category:** Kibana\
**Created:** [May 14, 2015, 2:34pm UTC](https://discuss.elastic.co/t/extracting-hour-from-date-field-scripted-field/691 "2015-05-14T14:34:59Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Nuno\_Boavida](https://avatars.discourse-cdn.com/v4/letter/n/c89c15/32.png) [@Nuno\_Boavida](https://discuss.elastic.co/u/Nuno_Boavida)\
**Post date:** [March 31, 2017, 3:02pm UTC](https://discuss.elastic.co/t/extracting-hour-from-date-field-scripted-field/691/6 "2017-03-31T15:02:24Z")

</div>

Hello Mahdy, for the record, i managed to accomplish that using the following expression

**Integer.parseInt(new SimpleDateFormat("HH").format(new Date(doc["created\_on"].value)))**

Regards

---

_[View the full topic](https://discuss.elastic.co/t/extracting-hour-from-date-field-scripted-field/691)._
