Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Converting from Unix time (secs since 1970) to a date using Jira Automation

Rodney Dsouza (Atlassian Certified Expert)
Contributor
August 5, 2024

I am integrating with an external system using Jira Automation.   That external system is returning date values in seconds-since-1970 e.g. Aug 6, 2024 is being returned as 1722906223

 

I have mulled over this a bit.   And tried various ideas but am a bit stumped as to how to actually make it work with Jira Automation.  Note that this is all within the context of getting data from another system and processing a list of items (so in Jira Automation terms, this is already within a branch).

While trying to write something with Jira Automation I was running into its limitations e.g. cannot use a variable within and expression,  cannot do math within an expression, etc.

If it makes any difference, I am putting the computed value into a JSM Assets object (not an Assets field either).  I am NOT dealing with Jira issues in this context.

 

 

1 answer

0 votes
Rodney Dsouza (Atlassian Certified Expert)
Contributor
August 5, 2024

Figured it out, I was doing one thing wrong.

The solution is simple-enough:

For testing/dev purposes assume value to be converted is in a variable named "AugustSixTwentyFour" with value of 1722906223  (Unix time for 6 Aug 2024)

 

Define a Variable "JanOneSeventy" with value "01/01/1970"

 

This should give the correct answer:

{{JanOneSeventy.toDate("dd/MM/yyyy").plusSeconds(AugustSixTwentyFour.asNumber)}}

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events