README.rst 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. dateutil - powerful extensions to datetime
  2. ==========================================
  3. |pypi| |support| |licence|
  4. |gitter| |readthedocs|
  5. |travis| |appveyor| |pipelines| |coverage|
  6. .. |pypi| image:: https://img.shields.io/pypi/v/python-dateutil.svg?style=flat-square
  7. :target: https://pypi.org/project/python-dateutil/
  8. :alt: pypi version
  9. .. |support| image:: https://img.shields.io/pypi/pyversions/python-dateutil.svg?style=flat-square
  10. :target: https://pypi.org/project/python-dateutil/
  11. :alt: supported Python version
  12. .. |travis| image:: https://img.shields.io/travis/dateutil/dateutil/master.svg?style=flat-square&label=Travis%20Build
  13. :target: https://travis-ci.org/dateutil/dateutil
  14. :alt: travis build status
  15. .. |appveyor| image:: https://img.shields.io/appveyor/ci/dateutil/dateutil/master.svg?style=flat-square&logo=appveyor
  16. :target: https://ci.appveyor.com/project/dateutil/dateutil
  17. :alt: appveyor build status
  18. .. |pipelines| image:: https://dev.azure.com/pythondateutilazure/dateutil/_apis/build/status/dateutil.dateutil?branchName=master
  19. :target: https://dev.azure.com/pythondateutilazure/dateutil/_build/latest?definitionId=1&branchName=master
  20. :alt: azure pipelines build status
  21. .. |coverage| image:: https://codecov.io/gh/dateutil/dateutil/branch/master/graphs/badge.svg?branch=master
  22. :target: https://codecov.io/gh/dateutil/dateutil?branch=master
  23. :alt: Code coverage
  24. .. |gitter| image:: https://badges.gitter.im/dateutil/dateutil.svg
  25. :alt: Join the chat at https://gitter.im/dateutil/dateutil
  26. :target: https://gitter.im/dateutil/dateutil
  27. .. |licence| image:: https://img.shields.io/pypi/l/python-dateutil.svg?style=flat-square
  28. :target: https://pypi.org/project/python-dateutil/
  29. :alt: licence
  30. .. |readthedocs| image:: https://img.shields.io/readthedocs/dateutil/latest.svg?style=flat-square&label=Read%20the%20Docs
  31. :alt: Read the documentation at https://dateutil.readthedocs.io/en/latest/
  32. :target: https://dateutil.readthedocs.io/en/latest/
  33. The `dateutil` module provides powerful extensions to
  34. the standard `datetime` module, available in Python.
  35. Installation
  36. ============
  37. `dateutil` can be installed from PyPI using `pip` (note that the package name is
  38. different from the importable name)::
  39. pip install python-dateutil
  40. Download
  41. ========
  42. dateutil is available on PyPI
  43. https://pypi.org/project/python-dateutil/
  44. The documentation is hosted at:
  45. https://dateutil.readthedocs.io/en/stable/
  46. Code
  47. ====
  48. The code and issue tracker are hosted on GitHub:
  49. https://github.com/dateutil/dateutil/
  50. Features
  51. ========
  52. * Computing of relative deltas (next month, next year,
  53. next Monday, last week of month, etc);
  54. * Computing of relative deltas between two given
  55. date and/or datetime objects;
  56. * Computing of dates based on very flexible recurrence rules,
  57. using a superset of the `iCalendar <https://www.ietf.org/rfc/rfc2445.txt>`_
  58. specification. Parsing of RFC strings is supported as well.
  59. * Generic parsing of dates in almost any string format;
  60. * Timezone (tzinfo) implementations for tzfile(5) format
  61. files (/etc/localtime, /usr/share/zoneinfo, etc), TZ
  62. environment string (in all known formats), iCalendar
  63. format files, given ranges (with help from relative deltas),
  64. local machine timezone, fixed offset timezone, UTC timezone,
  65. and Windows registry-based time zones.
  66. * Internal up-to-date world timezone information based on
  67. Olson's database.
  68. * Computing of Easter Sunday dates for any given year,
  69. using Western, Orthodox or Julian algorithms;
  70. * A comprehensive test suite.
  71. Quick example
  72. =============
  73. Here's a snapshot, just to give an idea about the power of the
  74. package. For more examples, look at the documentation.
  75. Suppose you want to know how much time is left, in
  76. years/months/days/etc, before the next easter happening on a
  77. year with a Friday 13th in August, and you want to get today's
  78. date out of the "date" unix system command. Here is the code:
  79. .. doctest:: readmeexample
  80. >>> from dateutil.relativedelta import *
  81. >>> from dateutil.easter import *
  82. >>> from dateutil.rrule import *
  83. >>> from dateutil.parser import *
  84. >>> from datetime import *
  85. >>> now = parse("Sat Oct 11 17:13:46 UTC 2003")
  86. >>> today = now.date()
  87. >>> year = rrule(YEARLY,dtstart=now,bymonth=8,bymonthday=13,byweekday=FR)[0].year
  88. >>> rdelta = relativedelta(easter(year), today)
  89. >>> print("Today is: %s" % today)
  90. Today is: 2003-10-11
  91. >>> print("Year with next Aug 13th on a Friday is: %s" % year)
  92. Year with next Aug 13th on a Friday is: 2004
  93. >>> print("How far is the Easter of that year: %s" % rdelta)
  94. How far is the Easter of that year: relativedelta(months=+6)
  95. >>> print("And the Easter of that year is: %s" % (today+rdelta))
  96. And the Easter of that year is: 2004-04-11
  97. Being exactly 6 months ahead was **really** a coincidence :)
  98. Contributing
  99. ============
  100. We welcome many types of contributions - bug reports, pull requests (code, infrastructure or documentation fixes). For more information about how to contribute to the project, see the ``CONTRIBUTING.md`` file in the repository.
  101. Author
  102. ======
  103. The dateutil module was written by Gustavo Niemeyer <gustavo@niemeyer.net>
  104. in 2003.
  105. It is maintained by:
  106. * Gustavo Niemeyer <gustavo@niemeyer.net> 2003-2011
  107. * Tomi Pieviläinen <tomi.pievilainen@iki.fi> 2012-2014
  108. * Yaron de Leeuw <me@jarondl.net> 2014-2016
  109. * Paul Ganssle <paul@ganssle.io> 2015-
  110. Starting with version 2.4.1 and running until 2.8.2, all source and binary
  111. distributions will be signed by a PGP key that has, at the very least, been
  112. signed by the key which made the previous release. A table of release signing
  113. keys can be found below:
  114. =========== ============================
  115. Releases Signing key fingerprint
  116. =========== ============================
  117. 2.4.1-2.8.2 `6B49 ACBA DCF6 BD1C A206 67AB CD54 FCE3 D964 BEFB`_
  118. =========== ============================
  119. New releases *may* have signed tags, but binary and source distributions
  120. uploaded to PyPI will no longer have GPG signatures attached.
  121. Contact
  122. =======
  123. Our mailing list is available at `dateutil@python.org <https://mail.python.org/mailman/listinfo/dateutil>`_. As it is hosted by the PSF, it is subject to the `PSF code of
  124. conduct <https://www.python.org/psf/conduct/>`_.
  125. License
  126. =======
  127. All contributions after December 1, 2017 released under dual license - either `Apache 2.0 License <https://www.apache.org/licenses/LICENSE-2.0>`_ or the `BSD 3-Clause License <https://opensource.org/licenses/BSD-3-Clause>`_. Contributions before December 1, 2017 - except those those explicitly relicensed - are released only under the BSD 3-Clause License.
  128. .. _6B49 ACBA DCF6 BD1C A206 67AB CD54 FCE3 D964 BEFB:
  129. https://pgp.mit.edu/pks/lookup?op=vindex&search=0xCD54FCE3D964BEFB