jakn
September 17, 2018, 11:36am
1
I use the following transform in a watcher
"transform": {
"script": {
"source": "return [ 'time_triggered': Instant.ofEpochMilli(ctx.trigger.triggered_time.getMillis()).atZone(ZoneId.of('Europe/Copenhagen')) ]",
"lang": "painless"
}
}
Which outputs a timestamp like
2018-08-16T10:13:58.698+02:00[Europe/Copenhagen]
Instead I would like to be able to insert this output in an email action.
2018-08-16 10:13:58
How do I get that string?
spinscale
(Alexander Reelsen)
September 17, 2018, 12:45pm
2
try using a date formatter (new lines for the sake of readability)
return [ 'time_triggered': Instant.ofEpochMilli(ctx.trigger.triggered_time.getMillis())
.atZone(ZoneId.of('Europe/Copenhagen'))
.format(DateTimeFormatter.ofPattern('YYYY-MM-dd HH:mm:ss')) ]
system
(system)
Closed
October 15, 2018, 12:45pm
3
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.