Discussion posts and replies are publicly visible
Since a Unix timestamp is the number of seconds from 01/01/1970 till now, you can try something like this:
(1651670870 / 86400) + datetime(1970, 01, 01, 00, 00)
Hello Ernesto,sounds stupid but you caculate itUnix time is basically a time difference. This count starts at the Unix Epoch on January 1st, 1970 at UTC
We are around at unix timestamp of 1651674100 currentlySo 1651674100/3600 = is the amount of hoursA Years is 1651674100/ 31556926 is the amount of yearshttps://www.unixtimestamp.com/perhaps somebody has a suitable formula available. but basically you calculate what your number means as time difference
I was going to suggest the intervalds() function, but upon testing it appears to not like large values for seconds.
That said, the seconds() function appears to work here, too, if it helps anyone simplify things slightly.
datetime(1970, 1, 1, 00, 00) + second() * 1651670870
Edit to add: I never realized there's an addSeconds() function too. Maybe it's newer? (edit: it's from a plug-in, thanks Richard)
addseconds(datetime(1970, 1, 1, 00, 00), 1651670870)
Lets see if we can work out the math ourselves.
So unix timestamp is seconds since 1970. Appian timestamp is DAYS since 2035 (so it's actually a negative number that keeps diminishing for now).
Perhaps what you do is convert seconds to days, so Unix timestamp / ( 3600 times 24). That gives you days since 1970 and Appian has days since 2035. Simple addition or subtraction should get you from there.
You can do lots of things to calculate it. One time, I said, "Duh, 525600 minutes!", and my friend sitting next to me said, "Did you just use the RENT method?" I did. I remembered that song from RENT (don't watch if you can avoid).
sure "addSeconds() " is an official appian function and no plugin function?Edit: aaah found it: https://community.appian.com/b/appmarket/posts/date-and-time-utilities
Use the following plugin:https://community.appian.com/b/appmarket/posts/date-and-time-utilitiesIt has two new functions:
Good point, I didn't check that far. That's probably why I didn't recognize it (my dev environment is one i inherited with a bunch of plug-ins already installed which I didn't vet myself).
I was also looking for that function tbh although I haven't used it before.
And I was wondering how is possible that there isn't available a basic function like this so far.
Regarding the conversion, the ePoch timestamp to Appian dateTime conversion is not so accurate. If you check the minutes on the hour are not the same as the current hour.
The conversion to date is fine but if you need the response date to be precise, then you need a different formula.
PS. this is a nice to have function from Appian.
Edit. there is a function: fromUnixTimestamp() but the result is the same as the solution we gave so far.
Unknown said:(don't watch if you can avoid)
lol, it's a good show though!