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?
Hi @Ben Hart
I recall the easiest way to do this is:
{{#now}}format="toMillis"{{/}}
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,
Bill
This is my first experiment:
A webcall to https://currentmillis.com/time/minutes-since-unix-epoch.php
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.