# Is there a way to support different time zone when my email title is “error occurs at {{ctx.trigger.scheduled\_time}}”?

**URL:** <https://discuss.elastic.co/t/is-there-a-way-to-support-different-time-zone-when-my-email-title-is-error-occurs-at-ctx-trigger-scheduled-time/32455>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [October 19, 2015, 6:22am UTC](https://discuss.elastic.co/t/is-there-a-way-to-support-different-time-zone-when-my-email-title-is-error-occurs-at-ctx-trigger-scheduled-time/32455 "2015-10-19T06:22:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Enniu\_51](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/enniu_51/32/5310_2.png) [@Enniu\_51](https://discuss.elastic.co/u/Enniu_51)\
**Post date:** [October 19, 2015, 6:22am UTC](https://discuss.elastic.co/t/is-there-a-way-to-support-different-time-zone-when-my-email-title-is-error-occurs-at-ctx-trigger-scheduled-time/32455/1 "2015-10-19T06:22:04Z")

</div>

I get:

```
error occurs at 2015-10-19T04:30:00.000Z

```

But our time zone is `GMT+8`, So it should be `2015-10-19T12:30:00.000Z`. Is there a way do it in Email Action?

---

<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:** [October 19, 2015, 8:57am UTC](https://discuss.elastic.co/t/is-there-a-way-to-support-different-time-zone-when-my-email-title-is-error-occurs-at-ctx-trigger-scheduled-time/32455/2 "2015-10-19T08:57:10Z")

</div>

Hey there,

you can use the the joda date time formatters to do this. This is just a quick test and it worked, I think you can do this more efficiently.

```json
curl -XPUT 'http://localhost:9200/_watcher/watch/log_error_watch' -d '{
  "trigger" : { "schedule" : { "interval" : "10s" } },
  "input" : {
    "search" : {
      "request" : {
        "indices" : ["logs"],
        "body" : {
          "query" : {
            "match" : { "message": "error" }
          }
        }
      }
    }
  },
  "actions" : {
    "log_error" : {
      "transform" : {
        "script" : "time = org.joda.time.format.ISODateTimeFormat.dateTime().withZone(org.joda.time.DateTimeZone.forID(\"Europe/Berlin\")).parseDateTime(ctx.trigger.triggered_time.toString()).toString() ; return [time_as_string : time]"
      },
      "logging" : {
        "text" : "Converted time {{ctx.payload.time_as_string}} vs {{ctx.trigger.triggered_time}}"
      }
    }
  }
}'

```

--Alex

---

<div class="post-metadata">

**Author:** ![Enniu\_51](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/enniu_51/32/5310_2.png) [@Enniu\_51](https://discuss.elastic.co/u/Enniu_51)\
**Post date:** [October 19, 2015, 9:11am UTC](https://discuss.elastic.co/t/is-there-a-way-to-support-different-time-zone-when-my-email-title-is-error-occurs-at-ctx-trigger-scheduled-time/32455/3 "2015-10-19T09:11:37Z")

</div>

A great thanks for your kind help! I will try 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 6, 2017, 1:48pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-support-different-time-zone-when-my-email-title-is-error-occurs-at-ctx-trigger-scheduled-time/32455/4 "2017-07-06T13:48:21Z")

</div>


