Greg_Deckler's avatar
Greg_Deckler
Community Champion
7 years ago

Unix2UTC and UTC2Unix

Here are a couple of quick calculations to convert Unix time to UTC time and vice versa.


Unix2UTC

 

Unix2UTC = 
VAR UnixDays = MAX([UnixTime])/(60*60*24)
RETURN (DATEVALUE("1/1/1970")+UnixDays)

UTC2Unix

UTC2Unix = 
VAR __utc = [Unix2UTC]
RETURN (__utc - DATEVALUE("1/1/1970"))*60*60*24

 

 

 

1 Reply

  • schnarf78's avatar
    schnarf78
    Frequent Visitor

    Thank you Greg_Deckler . The first calculation worked for me, although I had to remove the MAX formula, and first had to extract the numbers from the /Date(, but otherwise perfect!