By trial and error, I've found that the following gives the current Unix time:
AbsoluteTime[] - UPOCH
where UPOCH can be defined in any of the following ways:
UPOCH = Round[AbsoluteTime[{1970, 1, 1, 0, 0, 0}, TimeZone->-14]]
UPOCH = Round[AbsoluteTime[{1969, 12, 31, 10, 0, 0}, TimeZone->0]]
UPOCH = Round[AbsoluteTime[{1970, 1, 1, TimeZone[], 0, 0}]]
UPOCH = 2208963600
Just as you can subtract UPOCH to convert Mathematica's AbsoluteTime to Unix time, you can convert a Unix time to Mathematica's epoch time by adding UPOCH.
My question is why? Why isn't it AbsoluteTime[{1970,1,1, 0,0,0}, TimeZone->0]
?
Related question: UNIX time to DateList
UPDATE: Here's what you actually want (thanks to @2012rcampion):
UPOCH = AbsoluteTime[DateObject[{1970, 1, 1, 0, 0, 0}, TimeZone->0]]
UPOCH
give different results:2208934800
,2208934800
,2208992400
and2208963600
. Is this correct? $\endgroup$ – shrx Mar 23 '15 at 9:07