# Format triggered\_time to local time zone in action

**URL:** <https://discuss.elastic.co/t/format-triggered-time-to-local-time-zone-in-action/144299>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [August 14, 2018, 8:37am UTC](https://discuss.elastic.co/t/format-triggered-time-to-local-time-zone-in-action/144299 "2018-08-14T08:37:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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 14, 2018, 9:12am UTC](https://discuss.elastic.co/t/format-triggered-time-to-local-time-zone-in-action/144299/2 "2018-08-14T09:12:16Z")

</div>

try this (note that this example fully overwrites the payload, you may want to add this to the additional payload instead)

```auto
POST _xpack/watcher/watch/_execute
{
  "watch": {
    "trigger": {
      "schedule": {
        "interval": "10s"
      }
    },
    "input": {
      "simple": {}
    },
    "actions": {
      "log_error": {
        "transform": {
          "script": """
return ['date': Instant.ofEpochMilli(ctx.trigger.triggered_time.getMillis()).atZone(ZoneId.of("Europe/Copenhagen"))]"""
        },
        "logging": {
          "text": "Triggered time (UTC):{{ctx.trigger.triggered_time}} - Triggered time (Europe/Copenhagen): {{ctx.payload.date}}"
        }
      }
    }
  }
}

```

---

_[View the full topic](https://discuss.elastic.co/t/format-triggered-time-to-local-time-zone-in-action/144299)._
