Message Boards Message Boards


Converting Unix seconds to date

Posted 9 years ago
2 Replies
0 Total Likes

How would I frame the query to convert from UNIX seconds to the date and time it represents?

For instance, the value 1409855505, translates into 2014-09-04 18:31:45 (UTC).

POSTED BY: Chuck Petras
2 Replies

The Wolfram Language function AbsoluteTime counts the number of seconds from Jan 1, 1900, while UNIX time is the number of seconds from Jan 1,1970.

You can convert pretty easily with the following:

DateList[1409855505 + AbsoluteTime[{1970}]]

which returns your expected:

 {2014, 9, 4, 18, 31, 45.}
POSTED BY: Jesus Hernandez

I'm not sure if that's built-in but you could query for that using the actual definition of UNIX seconds:

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract