2015-03-22 06:18:45 +00:00
|
|
|
``timeutils`` - ``datetime`` additions
|
|
|
|
======================================
|
2015-03-22 00:12:50 +00:00
|
|
|
|
|
|
|
.. automodule:: boltons.timeutils
|
2015-08-17 01:47:06 +00:00
|
|
|
|
|
|
|
.. autofunction:: total_seconds
|
2015-08-17 02:25:58 +00:00
|
|
|
.. autofunction:: dt_to_timestamp
|
2015-08-17 01:47:06 +00:00
|
|
|
.. autofunction:: isoparse
|
|
|
|
.. autofunction:: parse_timedelta
|
2015-08-17 02:25:58 +00:00
|
|
|
|
2015-08-17 01:47:06 +00:00
|
|
|
.. autofunction:: relative_time
|
|
|
|
.. autofunction:: decimal_relative_time
|
|
|
|
|
|
|
|
General timezones
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
By default, :class:`datetime.datetime` objects are "naïve", meaning
|
|
|
|
they lack attached timezone information. These objects can be useful
|
|
|
|
for many operations, but many operations require timezone-aware
|
|
|
|
datetimes.
|
|
|
|
|
|
|
|
The two most important timezones in programming are Coordinated
|
|
|
|
Universal Time (`UTC`_) and the local timezone of the host running
|
|
|
|
your code. Boltons provides two :class:`datetime.tzinfo` subtypes for
|
|
|
|
working with them:
|
|
|
|
|
|
|
|
.. _UTC: https://en.wikipedia.org/wiki/Coordinated_Universal_Time
|
|
|
|
|
|
|
|
.. autoattribute:: boltons.timeutils.UTC
|
|
|
|
.. autodata:: boltons.timeutils.LocalTZ
|
|
|
|
|
|
|
|
.. autoclass:: boltons.timeutils.ConstantTZInfo
|
|
|
|
|
|
|
|
US timezones
|
|
|
|
------------
|
|
|
|
|
|
|
|
These four US timezones were implemented in the :mod:`datetime`
|
|
|
|
documentation and have been reproduced here in boltons for
|
|
|
|
convenience. More in-depth support is provided by `pytz`_.
|
|
|
|
|
|
|
|
.. _pytz: https://pypi.python.org/pypi/pytz
|
|
|
|
|
|
|
|
.. autoattribute:: boltons.timeutils.Eastern
|
|
|
|
.. autoattribute:: boltons.timeutils.Central
|
|
|
|
.. autoattribute:: boltons.timeutils.Mountain
|
|
|
|
.. autoattribute:: boltons.timeutils.Pacific
|
|
|
|
|
|
|
|
.. autoclass:: boltons.timeutils.USTimeZone
|