Hello community,
I'm trying to automatically create annotations in Grafana, and for this, I need to pass an argument in millis (check the documentation here )
I tried this Jira smart value
{{now.millis}}
But it's returning something that is not the number I'm looking for
now={{now}} > now=2021-03-11T21:00:26.5+0000
milis={{now.millis}} > milis=524000000
Those millis, converted to UTC time is (check here for more details)
Wed Jan 07 1970 01:33:20
So, is there a way to do this? What does the value returned mean?
Hi Kian,
Milliseconds since Epoch was converted over from the old way of formatting dates.
Good news is the old way is still there:
{{#now}}toMillis{{/}}
We are tracking adding it to the new way here: https://codebarrel.atlassian.net/browse/AUT-1915
Hope that helps,
Nick
@nmenere : This is the best answer, and the most simple... but why isn't it anywhere in the documentation?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@nmenere,
Thanks for providing this answer! I was searching high and low for a way to do it outside of what I ended up doing. If Atlassian can get it added to the documentation that would be awesome!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The reason for documentation is that this way of formatting dates is deprecated. The old way is documented at - https://confluence.atlassian.com/automation/archived-date-functions-993924673.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a million. Thought it could not be done, but a friend at work showed me this answer and tested it and it worked :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@David Jose Silva Ruiz,
I don't know why that isn't working. I found the same behavior when I tried to use that format.
The only way I could eventually get this to work was by making a rest call to a publicly available API to give me the current epoch time and then passing that to another spot in my rule.
I used the endpoint https://showcase.api.linx.twenty57.net/UnixTime/tounix?date=now. That seemed to give me the epoch in seconds, so then to get it to milliseconds I just appended "00" to the end.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Kian Stack Mumo Systems ! I was working on a similar solution to yours, but querying https://currentmillis.com/time/minutes-since-unix-epoch.php (which returns minutes instead of millis), then I was converting them with this
{{#=}}{{webhookResponse.body}} * 60000{{/}}
I believe both work almost the same, thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was having problems with the formatting when I performed a multiplication. It kept returning a value in scientific notation instead which wasn't helpful!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kian Stack Mumo Systems @David Jose Silva Ruiz ,
I had a similar issue on converting Epoch Time to JIRA using Automation and I described the workaround here:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.