# How to capture "now" and "now-15m" in mail body?

**URL:** <https://discuss.elastic.co/t/how-to-capture-now-and-now-15m-in-mail-body/144905>\
**Category:** Elasticsearch\
**Created:** [August 17, 2018, 1:07pm UTC](https://discuss.elastic.co/t/how-to-capture-now-and-now-15m-in-mail-body/144905 "2018-08-17T13:07:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Debashis\_Adak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/debashis_adak/32/46087_2.png) [@Debashis\_Adak](https://discuss.elastic.co/u/Debashis_Adak)\
**Post date:** [August 17, 2018, 1:07pm UTC](https://discuss.elastic.co/t/how-to-capture-now-and-now-15m-in-mail-body/144905/1 "2018-08-17T13:07:34Z")

</div>

Hi All,

I am trying to capture the time "now" and "now-15m" in my mail body of the kibana watcher. Can you help me with the syntax?

Thanks & Regards,  
Debashis

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 20, 2018, 7:42am UTC](https://discuss.elastic.co/t/how-to-capture-now-and-now-15m-in-mail-body/144905/2 "2018-08-20T07:42:00Z")

</div>

Hey,

the definition of `now` is internal to an Elasticsearch query and not exposed. If it is ok to have a value that is nearby, you could use the execution time of the watch context by using `{{ctx.execution_time}}`.

hope this helps

--Alex

---

<div class="post-metadata">

**Author:** ![Debashis\_Adak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/debashis_adak/32/46087_2.png) [@Debashis\_Adak](https://discuss.elastic.co/u/Debashis_Adak)\
**Post date:** [August 20, 2018, 7:55am UTC](https://discuss.elastic.co/t/how-to-capture-now-and-now-15m-in-mail-body/144905/3 "2018-08-20T07:55:39Z")

</div>

Hi Alex,

Thanks for answering the query. Is there any way we can calculate "{{ctx.execution\_time}}-15 minutes" in the mail body?

Thanks & Regards,  
Debashis Adak

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 20, 2018, 10:10am UTC](https://discuss.elastic.co/t/how-to-capture-now-and-now-15m-in-mail-body/144905/4 "2018-08-20T10:10:43Z")

</div>

you could do a transform before the action and do sth like

```auto
def x = Instant.ofEpochMilli(ctx.execution_time.getMillis()).plusSeconds(60*15)

```

Note: untested, on top of my head.

--Alex

---

<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:** [September 17, 2018, 10:10am UTC](https://discuss.elastic.co/t/how-to-capture-now-and-now-15m-in-mail-body/144905/5 "2018-09-17T10:10:45Z")

</div>

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