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
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:
When I tested your amount, I got: 2024-09-25T09:10:48.7+0000
Kind regards,
Bill
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
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.