Forums

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

Convert date from automation response to date in Assets

Svante Gustafsson Björkegren
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.
August 30, 2025

Hey community,

I have an automation that gets all my automations via REST. In the response from the REST API call the date is formatted like this:
"created": 1727255448.771000000

My automation is creating Asset objects for each automation and I would like to have the attribute "Rule created" in my object type as a DateTime attribute.

I have tried to convert the value provided in the rest response to a format that goes into an Assets DateTime attribute but so far no luck.

Any tips or tricks how I can format my smart value in my automation to be accepted as a DateTime attribute in Assets?

Cheers,
// Svante

1 answer

3 votes
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.
August 30, 2025

Hi @Svante Gustafsson Björkegren 

The value is the number of seconds since the start of Unix time: the start of day on 1 January 1970.

To convert that for use as a date / time, the number could be multiplied by 1000 to convert to milliseconds and added to 1 Jan 1970.  For example:

  • action: create variable
    • name: varStartOfTime
    • smart value: {{now.withYear(1970).withDayOfYear(1).toDateTimeAtStartOfDay}}
  • action: create variable
    • name: varMyMillis
    • smart value: {{#=}}ROUND(1727255448.771000000 * 1000, 0){{/}}
  • get the value for some action...
    • {{varStartOfTime.toDate.plusMillis(varMyMillis.asNumber)}}

 

When I tested your amount, I got: 2024-09-25T09:10:48.7+0000

 

Kind regards,
Bill

Svante Gustafsson Björkegren
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.
August 31, 2025

Hey Bill,

Thnx for your solution, that worked perfect! I have a followup question on these DateTime values.

When I have converted the Unix time value from the REST response I would like to compare that DateTime with the DateTime stored in my Assets object. I have tried a number of different approaches but I can't get it right. Maybe you can identify what  I am doing wrong here. I have attached two screenshots, one with the actions I have come up with and one from the audit log.

I think it is tricky to get the formats right.

Looking forward to hear back from you.

Cheers,
// Svante

compare-dates-log.pngcompare-dates.png

Suggest an answer

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

Atlassian Community Events