Epoch time to UTC time

I have an epoch time that i need to convert to UTC date time format. I have downloaded community commons and used the lava action LongToDateTime, but the result is 1,12,1970. Is there an additional calculation that needs to be done to get the UCT date time format or should this action have returned the correct value as a variable? Thank you.
2 answers

While I'm far from a Mendix expert, this looks like a different in the epoch that Java uses as compared to what Unix uses ... milliseconds vs seconds.

I just used the Community Commons DateTimeToLong of [%CurrentDateTime%] and get 1406741928887. Taking Community Commons LongToDateTime of that value returns 7/30/14 10:38 AM.

Taking Community Commons LongToDateTime of round(1406741928887 div 1000) results in 1/16/70 11:45 PM.

On a Linux machine issuing 'date +%s' a 10-15 minutes after those results, shows 1406742701 ... which is about 800 seconds greater than the original long divided by 1000.

So, I think that the Community Commons method is working properly with an epoch expressed in milliseconds.



I had the same problem with the LongToDateTimefrom CC. I received the epoch time1590649318 from Azure. When I put in 1590649318 I get out 1/19/1970, 10:50 AM.  When I multiplied 1590649318  with 1000 I get the correct date time.

The java behind the LongToDateTime is very simple: new Date(value). This function expects an epoch time in milliseconds, but I gave the function an epoch time in seconds, so I need to multiply my epoch time with 1000 first.