Wolfram Language & System 10.3 (2015)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

UnixTime

UnixTime[]
gives the total number of seconds since the beginning of January 1, 1970, in the GMT time zone.

UnixTime[{y,m,d,h,m,s}]
gives the Unix time specification corresponding to a date list.

UnixTime[date]
gives the Unix time specification corresponding to a DateObject.

UnixTime["string"]
gives the Unix time specification corresponding to a date string.

UnixTime[{"string",{"e1","e2",}}]
takes the date string to contain the elements .

DetailsDetails

  • UnixTime[] returns the number of seconds that have elapsed since {1970, 1, 1, 0, 0, 0.} Greenwich Mean Time (GMT), not counting leap seconds.
  • UnixTime[time] assumes that the given time is in $TimeZone, unless it is a DateObject or TimeObject with an explicit TimeZone option value.
  • UnixTime[] returns the nearest whole second, down to a granularity of $TimeUnit seconds.
  • Shorter lists can be used in UnixTime[{y,m,}]: {y} is equivalent to , to , etc.
  • Values of m, d, h, m, s outside their normal ranges are appropriately reduced. Noninteger values of d, h, m, s can also be used.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Unix time in seconds since January 1, 1970:

In[1]:=
Click for copyable input
Out[1]=

Convert from a date object to Unix time:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Convert from a date string to Unix time:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Introduced in 2015
(10.1)