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.
@Bill Sheboy is there a way to do this in reverse? I have the Unix timestamp coming in from a webhook in milliseconds and want to display the date in an issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ste404
One way to do this would be using knowledge about the "start of epoch time", create a variable with that value, and then add the milliseconds to it:
Kind of a hack although I expect it should work.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.
Register today!Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.