I have data that is timestamped with UNIX time, which is the number of seconds since January 1, 1970 UTC. Unfortunately, it seems that most of the date and time functions in Mathematica are based on the system's local time zone. How can I convert a UNIX timestamp to a DateList
in UTC?
Answer
Since Mathematica version 10.1 there is the function FromUnixTime
that performs the conversion from a UNIX timestamp to a DateObject
.
FromUnixTime[1427793986]
FromUnixTime[1427793986] // DateList
{2015, 3, 31, 11, 26, 26.}
FromUnixTime[0, TimeZone -> 0]
Comments
Post a Comment