FromUnixTime
FromUnixTime[time]
gives a date object corresponding to a UnixTime specification.
Details and Options
- FromUnixTime[time] returns a DateObject expression based on the number of seconds time that have elapsed since {1970, 1, 1, 0, 0, 0.} Greenwich Mean Time (GMT), not counting leap seconds.
- FromUnixTime[time,TimeZone->z] generates a DateObject expression with time zone z. The default value is $TimeZone.
- The following options can be specified for generated dates:
-
CalendarType Automatic calendar system being used DateFormat Automatic format used to display date DateGranularity Automatic calendar granularity for the date TimeSystem "SmearedUTC" time system being used TimeZone Automatic time zone being used
Examples
open allclose allBasic Examples (2)
Create a DateObject expression from a Unix time specification:
Get the start date for Unix time, expressed in the GMT time zone:
Options (6)
CalendarType (1)
By default, dates are generated as Gregorian calendar dates:
Use CalendarType"Julian" to generate an object with the "Julian" calendar:
DateGranularity (1)
By default, dates are generated with "Instant" granularity:
Use DateGranularity"Day" to generate a day granular date:
TimeSystem (1)
Specify the output TimeSystem for the DateObject:
TimeZone (1)
Specify the time zone for the output DateObject expression:
Properties & Relations (2)
FromUnixTime converts from Unix time into a DateObject expression:
UnixTime converts back into Unix time form:
If Unix time was stored in a signed 32-bit integer, then it would cover a period of about 136 years:
FromUnixTime can work with much larger integers:
Possible Issues (1)
By default, FromUnixTime returns results in your $TimeZone:
For a historical value of a time stamp in a given location at a given time, LocalTime can be used:
Text
Wolfram Research (2015), FromUnixTime, Wolfram Language function, https://reference.wolfram.com/language/ref/FromUnixTime.html (updated 2023).
CMS
Wolfram Language. 2015. "FromUnixTime." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2023. https://reference.wolfram.com/language/ref/FromUnixTime.html.
APA
Wolfram Language. (2015). FromUnixTime. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FromUnixTime.html