# A workaround to use the current date in Kibana

**URL:** <https://discuss.elastic.co/t/a-workaround-to-use-the-current-date-in-kibana/46569>\
**Category:** Kibana\
**Created:** [April 6, 2016, 4:39pm UTC](https://discuss.elastic.co/t/a-workaround-to-use-the-current-date-in-kibana/46569 "2016-04-06T16:39:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![javieredo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javieredo/32/8949_2.png) [@javieredo](https://discuss.elastic.co/u/javieredo)\
**Post date:** [April 6, 2016, 4:39pm UTC](https://discuss.elastic.co/t/a-workaround-to-use-the-current-date-in-kibana/46569/1 "2016-04-06T16:39:07Z")

</div>

Hi all,

is there a way to get the current date in Kibana? We need to calculate the days between a date inside an index and the current date. We haven't been able to find a proper Lucene expression to get the current date. We have thought about adding a field in the source ES index to get this date or adding a scripted field to the query in order to get this date. Has any one of you got this current date before inside Kibana? Could there be a workaround using ES to get the date in Kibana?

Thanks!

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [April 6, 2016, 6:33pm UTC](https://discuss.elastic.co/t/a-workaround-to-use-the-current-date-in-kibana/46569/2 "2016-04-06T18:33:33Z")

</div>

I want to make sure I understand what you're asking. Are you trying to use the current date/time in your query, at query time? That's what it sounds like to me, but this comment is a bit confusing:

> We have thought about adding a field in the source ES index to get this date

If you index a date, then it won't be "current", it will be a static, simply whatever you put in that field.

---

<div class="post-metadata">

**Author:** ![javieredo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javieredo/32/8949_2.png) [@javieredo](https://discuss.elastic.co/u/javieredo)\
**Post date:** [April 6, 2016, 8:09pm UTC](https://discuss.elastic.co/t/a-workaround-to-use-the-current-date-in-kibana/46569/3 "2016-04-06T20:09:26Z")

</div>

Thanks for the reply. Yes you're right, if we add the field in the index it would be static. I would like to have the current date in a scripted field in Kibana or in the query that uses Kibana to access the ES index.

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [April 6, 2016, 11:26pm UTC](https://discuss.elastic.co/t/a-workaround-to-use-the-current-date-in-kibana/46569/4 "2016-04-06T23:26:44Z")

</div>

Unfortunately, that's not currently possible. Ideally you'd do it with a scripted field, but that doesn't currently support any kind of date formatting. It's something we're working on in Elasticsearch, but it's probably a little ways off still.

---

<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:56pm UTC](https://discuss.elastic.co/t/a-workaround-to-use-the-current-date-in-kibana/46569/5 "2017-07-06T13:56:45Z")

</div>


