Calculating epoch time in Automation rule?

Ben Hart May 6, 2024

I'm wanting to create a manual action that will perform a web request. The payload of this request defines a 'startDateTime' and an 'endDateTime', both of which are represented in epoch -> milliseconds.

The action should provide a value of 1 hour by default.. I am thinking about a second option for a custom time range but that's not as important to me as this 1 hour span is.


So my idea was, create a variable for {{now}} except it complains when I try to save {{now}} under a Create Variable step.

Also I got errors trying to set a smart value with math functions..


Anyone out there happen to do something like this?

2 answers

2 accepted

2 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 6, 2024

Hi @Ben Hart 

I recall the easiest way to do this is:


That will return the UNIX timestamp to milliseconds.

If you need some adjustments at the same time, such as incrementing a field, this would work:

{{#issue.Start date}}func=plusMonths(1), format="toMillis"{{/}}


FYI...I also did the brute-force calculation before I learned this approach, building the math expression for milliseconds since the start of 1970, and confirmed the results were the same.


Kind regards,

Ben Hart May 6, 2024

Works fine! And it's shorter than my route! Thanks man!

Like Bill Sheboy likes this
0 votes
Answer accepted
Ben Hart May 6, 2024

This is my first experiment:

A webcall to

Create var: epochMinutes {{webResponse.body}}

Add audit log: {{webResponse.body}}

Create var: epochMilli {{#=}}{{epochMinutes}} * 60000{{/}}

Add audit log: epochMilli


Now in the audit log, the log step for epochMilli is not displayed for some reason. However if I add a Then add comment, and define the comment with the same math syntax it does get added.

Ben Hart May 6, 2024

Ok next step.. another variable adding 3.6M seconds to {{epochMilli}}. This value, even though shortened to 1.71501054E12 actually works!


So with vars {{epochMilli}} and {{epochOneHour}} I can do what I was wanting to do.. which was an Action to send a device SDT to LogicMonitor for 1 hour.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events