FromUnixTime
✖
FromUnixTime
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)Summary of the most common use cases
Create a DateObject expression from a Unix time specification:
https://wolfram.com/xid/0b0kk8cx4wy-xcyvc
Get the start date for Unix time, expressed in the GMT time zone:
https://wolfram.com/xid/0b0kk8cx4wy-194928
Options (6)Common values & functionality for each option
CalendarType (1)
By default, dates are generated as Gregorian calendar dates:
https://wolfram.com/xid/0b0kk8cx4wy-k3b5he
Use CalendarType"Julian" to generate an object with the "Julian" calendar:
https://wolfram.com/xid/0b0kk8cx4wy-r66xg6
DateFormat (2)
DateGranularity (1)
By default, dates are generated with "Instant" granularity:
https://wolfram.com/xid/0b0kk8cx4wy-6z61y0
Use DateGranularity"Day" to generate a day granular date:
https://wolfram.com/xid/0b0kk8cx4wy-fzezaw
TimeSystem (1)
Specify the output TimeSystem for the DateObject:
https://wolfram.com/xid/0b0kk8cx4wy-dvuc5e
TimeZone (1)
Specify the time zone for the output DateObject expression:
https://wolfram.com/xid/0b0kk8cx4wy-bkzkzv
Properties & Relations (2)Properties of the function, and connections to other functions
FromUnixTime converts from Unix time into a DateObject expression:
https://wolfram.com/xid/0b0kk8cx4wy-3070k2
UnixTime converts back into Unix time form:
https://wolfram.com/xid/0b0kk8cx4wy-5reffh
If Unix time was stored in a signed 32-bit integer, then it would cover a period of about 136 years:
https://wolfram.com/xid/0b0kk8cx4wy-5ifqcf
https://wolfram.com/xid/0b0kk8cx4wy-s5h7g4
FromUnixTime can work with much larger integers:
https://wolfram.com/xid/0b0kk8cx4wy-k76808
Possible Issues (1)Common pitfalls and unexpected behavior
By default, FromUnixTime returns results in your $TimeZone:
https://wolfram.com/xid/0b0kk8cx4wy-py2yxp
For a historical value of a time stamp in a given location at a given time, LocalTime can be used:
https://wolfram.com/xid/0b0kk8cx4wy-3309ot
Wolfram Research (2015), FromUnixTime, Wolfram Language function, https://reference.wolfram.com/language/ref/FromUnixTime.html (updated 2023).
Text
Wolfram Research (2015), FromUnixTime, Wolfram Language function, https://reference.wolfram.com/language/ref/FromUnixTime.html (updated 2023).
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.
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
Wolfram Language. (2015). FromUnixTime. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FromUnixTime.html
BibTeX
@misc{reference.wolfram_2024_fromunixtime, author="Wolfram Research", title="{FromUnixTime}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/FromUnixTime.html}", note=[Accessed: 10-January-2025
]}
BibLaTeX
@online{reference.wolfram_2024_fromunixtime, organization={Wolfram Research}, title={FromUnixTime}, year={2023}, url={https://reference.wolfram.com/language/ref/FromUnixTime.html}, note=[Accessed: 10-January-2025
]}