Primary
datetime.fromtimestamp() ⚬|Documentation|1st|20251021201246-00-⌔
datetime — Basic date and time types — Python 3 documentation#datetime.datetime.fromtimestamp
method
classdatetime.fromtimestamp(timestamp, tz=None)Return the local date and time corresponding to the POSIX timestamp, such as is returned by
time.time(). If optional argument tz isNoneor not specified, the timestamp is converted to the platform’s local date and time, and the returneddatetimeobject is naive.If tz is not
None, it must be an instance of atzinfosubclass, and the timestamp is converted to tz ’s time zone.
fromtimestamp()may raiseOverflowError, if the timestamp is out of the range of values supported by the platform Clocaltime()orgmtime()functions, andOSErroronlocaltime()orgmtime()failure. It’s common for this to be restricted to years in 1970 through 2038. Note that on non-POSIX systems that include leap seconds in their notion of a timestamp, leap seconds are ignored byfromtimestamp(), and then it’s possible to have two timestamps differing by a second that yield identicaldatetimeobjects. This method is preferred overutcfromtimestamp().Changed in version 3.3: Raise
OverflowErrorinstead ofValueErrorif the timestamp is out of the range of values supported by the platform Clocaltime()orgmtime()functions. RaiseOSErrorinstead ofValueErroronlocaltime()orgmtime()failure.Changed in version 3.6:
fromtimestamp()may return instances withfoldset to 1.Printed 2026-06-28.
(echo:: @ ᯤ)
Link to original
Secondary
• • •