README.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. pytz - World Timezone Definitions for Python
  2. ============================================
  3. :Author: Stuart Bishop <stuart@stuartbishop.net>
  4. Introduction
  5. ~~~~~~~~~~~~
  6. pytz brings the Olson tz database into Python. This library allows
  7. accurate and cross platform timezone calculations using Python 2.4
  8. or higher. It also solves the issue of ambiguous times at the end
  9. of daylight saving time, which you can read more about in the Python
  10. Library Reference (``datetime.tzinfo``).
  11. Almost all of the Olson timezones are supported.
  12. .. note::
  13. Projects using Python 3.9 or later should be using the support
  14. now included as part of the standard library, and third party
  15. packages work with it such as `tzdata <https://pypi.org/project/tzdata/>`_.
  16. pytz offers no advantages beyond backwards compatibility with
  17. code written for earlier versions of Python.
  18. .. note::
  19. This library differs from the documented Python API for
  20. tzinfo implementations; if you want to create local wallclock
  21. times you need to use the ``localize()`` method documented in this
  22. document. In addition, if you perform date arithmetic on local
  23. times that cross DST boundaries, the result may be in an incorrect
  24. timezone (ie. subtract 1 minute from 2002-10-27 1:00 EST and you get
  25. 2002-10-27 0:59 EST instead of the correct 2002-10-27 1:59 EDT). A
  26. ``normalize()`` method is provided to correct this. Unfortunately these
  27. issues cannot be resolved without modifying the Python datetime
  28. implementation (see PEP-431).
  29. Installation
  30. ~~~~~~~~~~~~
  31. This package can either be installed using ``pip`` or from a tarball using the
  32. standard Python distutils.
  33. If you are installing using ``pip``, you don't need to download anything as the
  34. latest version will be downloaded for you from PyPI::
  35. pip install pytz
  36. If you are installing from a tarball, run the following command as an
  37. administrative user::
  38. python setup.py install
  39. pytz for Enterprise
  40. ~~~~~~~~~~~~~~~~~~~
  41. Available as part of the Tidelift Subscription.
  42. The maintainers of pytz and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. `Learn more. <https://tidelift.com/subscription/pkg/pypi-pytz?utm_source=pypi-pytz&utm_medium=referral&utm_campaign=enterprise&utm_term=repo>`_.
  43. Example & Usage
  44. ~~~~~~~~~~~~~~~
  45. Localized times and date arithmetic
  46. -----------------------------------
  47. >>> from datetime import datetime, timedelta
  48. >>> from pytz import timezone
  49. >>> import pytz
  50. >>> utc = pytz.utc
  51. >>> utc.zone
  52. 'UTC'
  53. >>> eastern = timezone('US/Eastern')
  54. >>> eastern.zone
  55. 'US/Eastern'
  56. >>> amsterdam = timezone('Europe/Amsterdam')
  57. >>> fmt = '%Y-%m-%d %H:%M:%S %Z%z'
  58. This library only supports two ways of building a localized time. The
  59. first is to use the ``localize()`` method provided by the pytz library.
  60. This is used to localize a naive datetime (datetime with no timezone
  61. information):
  62. >>> loc_dt = eastern.localize(datetime(2002, 10, 27, 6, 0, 0))
  63. >>> print(loc_dt.strftime(fmt))
  64. 2002-10-27 06:00:00 EST-0500
  65. The second way of building a localized time is by converting an existing
  66. localized time using the standard ``astimezone()`` method:
  67. >>> ams_dt = loc_dt.astimezone(amsterdam)
  68. >>> ams_dt.strftime(fmt)
  69. '2002-10-27 12:00:00 CET+0100'
  70. Unfortunately using the tzinfo argument of the standard datetime
  71. constructors ''does not work'' with pytz for many timezones.
  72. >>> datetime(2002, 10, 27, 12, 0, 0, tzinfo=amsterdam).strftime(fmt) # /!\ Does not work this way!
  73. '2002-10-27 12:00:00 LMT+0018'
  74. It is safe for timezones without daylight saving transitions though, such
  75. as UTC:
  76. >>> datetime(2002, 10, 27, 12, 0, 0, tzinfo=pytz.utc).strftime(fmt) # /!\ Not recommended except for UTC
  77. '2002-10-27 12:00:00 UTC+0000'
  78. The preferred way of dealing with times is to always work in UTC,
  79. converting to localtime only when generating output to be read
  80. by humans.
  81. >>> utc_dt = datetime(2002, 10, 27, 6, 0, 0, tzinfo=utc)
  82. >>> loc_dt = utc_dt.astimezone(eastern)
  83. >>> loc_dt.strftime(fmt)
  84. '2002-10-27 01:00:00 EST-0500'
  85. This library also allows you to do date arithmetic using local
  86. times, although it is more complicated than working in UTC as you
  87. need to use the ``normalize()`` method to handle daylight saving time
  88. and other timezone transitions. In this example, ``loc_dt`` is set
  89. to the instant when daylight saving time ends in the US/Eastern
  90. timezone.
  91. >>> before = loc_dt - timedelta(minutes=10)
  92. >>> before.strftime(fmt)
  93. '2002-10-27 00:50:00 EST-0500'
  94. >>> eastern.normalize(before).strftime(fmt)
  95. '2002-10-27 01:50:00 EDT-0400'
  96. >>> after = eastern.normalize(before + timedelta(minutes=20))
  97. >>> after.strftime(fmt)
  98. '2002-10-27 01:10:00 EST-0500'
  99. Creating local times is also tricky, and the reason why working with
  100. local times is not recommended. Unfortunately, you cannot just pass
  101. a ``tzinfo`` argument when constructing a datetime (see the next
  102. section for more details)
  103. >>> dt = datetime(2002, 10, 27, 1, 30, 0)
  104. >>> dt1 = eastern.localize(dt, is_dst=True)
  105. >>> dt1.strftime(fmt)
  106. '2002-10-27 01:30:00 EDT-0400'
  107. >>> dt2 = eastern.localize(dt, is_dst=False)
  108. >>> dt2.strftime(fmt)
  109. '2002-10-27 01:30:00 EST-0500'
  110. Converting between timezones is more easily done, using the
  111. standard astimezone method.
  112. >>> utc_dt = datetime.fromtimestamp(1143408899, tz=utc)
  113. >>> utc_dt.strftime(fmt)
  114. '2006-03-26 21:34:59 UTC+0000'
  115. >>> au_tz = timezone('Australia/Sydney')
  116. >>> au_dt = utc_dt.astimezone(au_tz)
  117. >>> au_dt.strftime(fmt)
  118. '2006-03-27 08:34:59 AEDT+1100'
  119. >>> utc_dt2 = au_dt.astimezone(utc)
  120. >>> utc_dt2.strftime(fmt)
  121. '2006-03-26 21:34:59 UTC+0000'
  122. >>> utc_dt == utc_dt2
  123. True
  124. You can take shortcuts when dealing with the UTC side of timezone
  125. conversions. ``normalize()`` and ``localize()`` are not really
  126. necessary when there are no daylight saving time transitions to
  127. deal with.
  128. >>> utc_dt = datetime.fromtimestamp(1143408899, tz=utc)
  129. >>> utc_dt.strftime(fmt)
  130. '2006-03-26 21:34:59 UTC+0000'
  131. >>> au_tz = timezone('Australia/Sydney')
  132. >>> au_dt = au_tz.normalize(utc_dt.astimezone(au_tz))
  133. >>> au_dt.strftime(fmt)
  134. '2006-03-27 08:34:59 AEDT+1100'
  135. >>> utc_dt2 = au_dt.astimezone(utc)
  136. >>> utc_dt2.strftime(fmt)
  137. '2006-03-26 21:34:59 UTC+0000'
  138. ``tzinfo`` API
  139. --------------
  140. The ``tzinfo`` instances returned by the ``timezone()`` function have
  141. been extended to cope with ambiguous times by adding an ``is_dst``
  142. parameter to the ``utcoffset()``, ``dst()`` && ``tzname()`` methods.
  143. >>> tz = timezone('America/St_Johns')
  144. >>> normal = datetime(2009, 9, 1)
  145. >>> ambiguous = datetime(2009, 10, 31, 23, 30)
  146. The ``is_dst`` parameter is ignored for most timestamps. It is only used
  147. during DST transition ambiguous periods to resolve that ambiguity.
  148. >>> print(tz.utcoffset(normal, is_dst=True))
  149. -1 day, 21:30:00
  150. >>> print(tz.dst(normal, is_dst=True))
  151. 1:00:00
  152. >>> tz.tzname(normal, is_dst=True)
  153. 'NDT'
  154. >>> print(tz.utcoffset(ambiguous, is_dst=True))
  155. -1 day, 21:30:00
  156. >>> print(tz.dst(ambiguous, is_dst=True))
  157. 1:00:00
  158. >>> tz.tzname(ambiguous, is_dst=True)
  159. 'NDT'
  160. >>> print(tz.utcoffset(normal, is_dst=False))
  161. -1 day, 21:30:00
  162. >>> tz.dst(normal, is_dst=False).seconds
  163. 3600
  164. >>> tz.tzname(normal, is_dst=False)
  165. 'NDT'
  166. >>> print(tz.utcoffset(ambiguous, is_dst=False))
  167. -1 day, 20:30:00
  168. >>> tz.dst(ambiguous, is_dst=False)
  169. datetime.timedelta(0)
  170. >>> tz.tzname(ambiguous, is_dst=False)
  171. 'NST'
  172. If ``is_dst`` is not specified, ambiguous timestamps will raise
  173. an ``pytz.exceptions.AmbiguousTimeError`` exception.
  174. >>> print(tz.utcoffset(normal))
  175. -1 day, 21:30:00
  176. >>> print(tz.dst(normal))
  177. 1:00:00
  178. >>> tz.tzname(normal)
  179. 'NDT'
  180. >>> import pytz.exceptions
  181. >>> try:
  182. ... tz.utcoffset(ambiguous)
  183. ... except pytz.exceptions.AmbiguousTimeError:
  184. ... print('pytz.exceptions.AmbiguousTimeError: %s' % ambiguous)
  185. pytz.exceptions.AmbiguousTimeError: 2009-10-31 23:30:00
  186. >>> try:
  187. ... tz.dst(ambiguous)
  188. ... except pytz.exceptions.AmbiguousTimeError:
  189. ... print('pytz.exceptions.AmbiguousTimeError: %s' % ambiguous)
  190. pytz.exceptions.AmbiguousTimeError: 2009-10-31 23:30:00
  191. >>> try:
  192. ... tz.tzname(ambiguous)
  193. ... except pytz.exceptions.AmbiguousTimeError:
  194. ... print('pytz.exceptions.AmbiguousTimeError: %s' % ambiguous)
  195. pytz.exceptions.AmbiguousTimeError: 2009-10-31 23:30:00
  196. Problems with Localtime
  197. ~~~~~~~~~~~~~~~~~~~~~~~
  198. The major problem we have to deal with is that certain datetimes
  199. may occur twice in a year. For example, in the US/Eastern timezone
  200. on the last Sunday morning in October, the following sequence
  201. happens:
  202. - 01:00 EDT occurs
  203. - 1 hour later, instead of 2:00am the clock is turned back 1 hour
  204. and 01:00 happens again (this time 01:00 EST)
  205. In fact, every instant between 01:00 and 02:00 occurs twice. This means
  206. that if you try and create a time in the 'US/Eastern' timezone
  207. the standard datetime syntax, there is no way to specify if you meant
  208. before of after the end-of-daylight-saving-time transition. Using the
  209. pytz custom syntax, the best you can do is make an educated guess:
  210. >>> loc_dt = eastern.localize(datetime(2002, 10, 27, 1, 30, 00))
  211. >>> loc_dt.strftime(fmt)
  212. '2002-10-27 01:30:00 EST-0500'
  213. As you can see, the system has chosen one for you and there is a 50%
  214. chance of it being out by one hour. For some applications, this does
  215. not matter. However, if you are trying to schedule meetings with people
  216. in different timezones or analyze log files it is not acceptable.
  217. The best and simplest solution is to stick with using UTC. The pytz
  218. package encourages using UTC for internal timezone representation by
  219. including a special UTC implementation based on the standard Python
  220. reference implementation in the Python documentation.
  221. The UTC timezone unpickles to be the same instance, and pickles to a
  222. smaller size than other pytz tzinfo instances. The UTC implementation
  223. can be obtained as pytz.utc, pytz.UTC, or pytz.timezone('UTC').
  224. >>> import pickle, pytz
  225. >>> dt = datetime(2005, 3, 1, 14, 13, 21, tzinfo=utc)
  226. >>> naive = dt.replace(tzinfo=None)
  227. >>> p = pickle.dumps(dt, 1)
  228. >>> naive_p = pickle.dumps(naive, 1)
  229. >>> len(p) - len(naive_p)
  230. 17
  231. >>> new = pickle.loads(p)
  232. >>> new == dt
  233. True
  234. >>> new is dt
  235. False
  236. >>> new.tzinfo is dt.tzinfo
  237. True
  238. >>> pytz.utc is pytz.UTC is pytz.timezone('UTC')
  239. True
  240. Note that some other timezones are commonly thought of as the same (GMT,
  241. Greenwich, Universal, etc.). The definition of UTC is distinct from these
  242. other timezones, and they are not equivalent. For this reason, they will
  243. not compare the same in Python.
  244. >>> utc == pytz.timezone('GMT')
  245. False
  246. See the section `What is UTC`_, below.
  247. If you insist on working with local times, this library provides a
  248. facility for constructing them unambiguously:
  249. >>> loc_dt = datetime(2002, 10, 27, 1, 30, 00)
  250. >>> est_dt = eastern.localize(loc_dt, is_dst=True)
  251. >>> edt_dt = eastern.localize(loc_dt, is_dst=False)
  252. >>> print(est_dt.strftime(fmt) + ' / ' + edt_dt.strftime(fmt))
  253. 2002-10-27 01:30:00 EDT-0400 / 2002-10-27 01:30:00 EST-0500
  254. If you pass None as the is_dst flag to localize(), pytz will refuse to
  255. guess and raise exceptions if you try to build ambiguous or non-existent
  256. times.
  257. For example, 1:30am on 27th Oct 2002 happened twice in the US/Eastern
  258. timezone when the clocks where put back at the end of Daylight Saving
  259. Time:
  260. >>> dt = datetime(2002, 10, 27, 1, 30, 00)
  261. >>> try:
  262. ... eastern.localize(dt, is_dst=None)
  263. ... except pytz.exceptions.AmbiguousTimeError:
  264. ... print('pytz.exceptions.AmbiguousTimeError: %s' % dt)
  265. pytz.exceptions.AmbiguousTimeError: 2002-10-27 01:30:00
  266. Similarly, 2:30am on 7th April 2002 never happened at all in the
  267. US/Eastern timezone, as the clocks where put forward at 2:00am skipping
  268. the entire hour:
  269. >>> dt = datetime(2002, 4, 7, 2, 30, 00)
  270. >>> try:
  271. ... eastern.localize(dt, is_dst=None)
  272. ... except pytz.exceptions.NonExistentTimeError:
  273. ... print('pytz.exceptions.NonExistentTimeError: %s' % dt)
  274. pytz.exceptions.NonExistentTimeError: 2002-04-07 02:30:00
  275. Both of these exceptions share a common base class to make error handling
  276. easier:
  277. >>> isinstance(pytz.AmbiguousTimeError(), pytz.InvalidTimeError)
  278. True
  279. >>> isinstance(pytz.NonExistentTimeError(), pytz.InvalidTimeError)
  280. True
  281. A special case is where countries change their timezone definitions
  282. with no daylight savings time switch. For example, in 1915 Warsaw
  283. switched from Warsaw time to Central European time with no daylight savings
  284. transition. So at the stroke of midnight on August 5th 1915 the clocks
  285. were wound back 24 minutes creating an ambiguous time period that cannot
  286. be specified without referring to the timezone abbreviation or the
  287. actual UTC offset. In this case midnight happened twice, neither time
  288. during a daylight saving time period. pytz handles this transition by
  289. treating the ambiguous period before the switch as daylight savings
  290. time, and the ambiguous period after as standard time.
  291. >>> warsaw = pytz.timezone('Europe/Warsaw')
  292. >>> amb_dt1 = warsaw.localize(datetime(1915, 8, 4, 23, 59, 59), is_dst=True)
  293. >>> amb_dt1.strftime(fmt)
  294. '1915-08-04 23:59:59 WMT+0124'
  295. >>> amb_dt2 = warsaw.localize(datetime(1915, 8, 4, 23, 59, 59), is_dst=False)
  296. >>> amb_dt2.strftime(fmt)
  297. '1915-08-04 23:59:59 CET+0100'
  298. >>> switch_dt = warsaw.localize(datetime(1915, 8, 5, 00, 00, 00), is_dst=False)
  299. >>> switch_dt.strftime(fmt)
  300. '1915-08-05 00:00:00 CET+0100'
  301. >>> str(switch_dt - amb_dt1)
  302. '0:24:01'
  303. >>> str(switch_dt - amb_dt2)
  304. '0:00:01'
  305. The best way of creating a time during an ambiguous time period is
  306. by converting from another timezone such as UTC:
  307. >>> utc_dt = datetime(1915, 8, 4, 22, 36, tzinfo=pytz.utc)
  308. >>> utc_dt.astimezone(warsaw).strftime(fmt)
  309. '1915-08-04 23:36:00 CET+0100'
  310. The standard Python way of handling all these ambiguities is not to
  311. handle them, such as demonstrated in this example using the US/Eastern
  312. timezone definition from the Python documentation (Note that this
  313. implementation only works for dates between 1987 and 2006 - it is
  314. included for tests only!):
  315. >>> from pytz.reference import Eastern # pytz.reference only for tests
  316. >>> dt = datetime(2002, 10, 27, 0, 30, tzinfo=Eastern)
  317. >>> str(dt)
  318. '2002-10-27 00:30:00-04:00'
  319. >>> str(dt + timedelta(hours=1))
  320. '2002-10-27 01:30:00-05:00'
  321. >>> str(dt + timedelta(hours=2))
  322. '2002-10-27 02:30:00-05:00'
  323. >>> str(dt + timedelta(hours=3))
  324. '2002-10-27 03:30:00-05:00'
  325. Notice the first two results? At first glance you might think they are
  326. correct, but taking the UTC offset into account you find that they are
  327. actually two hours appart instead of the 1 hour we asked for.
  328. >>> from pytz.reference import UTC # pytz.reference only for tests
  329. >>> str(dt.astimezone(UTC))
  330. '2002-10-27 04:30:00+00:00'
  331. >>> str((dt + timedelta(hours=1)).astimezone(UTC))
  332. '2002-10-27 06:30:00+00:00'
  333. Country Information
  334. ~~~~~~~~~~~~~~~~~~~
  335. A mechanism is provided to access the timezones commonly in use
  336. for a particular country, looked up using the ISO 3166 country code.
  337. It returns a list of strings that can be used to retrieve the relevant
  338. tzinfo instance using ``pytz.timezone()``:
  339. >>> print(' '.join(pytz.country_timezones['nz']))
  340. Pacific/Auckland Pacific/Chatham
  341. The Olson database comes with a ISO 3166 country code to English country
  342. name mapping that pytz exposes as a dictionary:
  343. >>> print(pytz.country_names['nz'])
  344. New Zealand
  345. What is UTC
  346. ~~~~~~~~~~~
  347. 'UTC' is `Coordinated Universal Time`_. It is a successor to, but distinct
  348. from, Greenwich Mean Time (GMT) and the various definitions of Universal
  349. Time. UTC is now the worldwide standard for regulating clocks and time
  350. measurement.
  351. All other timezones are defined relative to UTC, and include offsets like
  352. UTC+0800 - hours to add or subtract from UTC to derive the local time. No
  353. daylight saving time occurs in UTC, making it a useful timezone to perform
  354. date arithmetic without worrying about the confusion and ambiguities caused
  355. by daylight saving time transitions, your country changing its timezone, or
  356. mobile computers that roam through multiple timezones.
  357. .. _Coordinated Universal Time: https://en.wikipedia.org/wiki/Coordinated_Universal_Time
  358. Helpers
  359. ~~~~~~~
  360. There are two lists of timezones provided.
  361. ``all_timezones`` is the exhaustive list of the timezone names that can
  362. be used.
  363. >>> from pytz import all_timezones
  364. >>> len(all_timezones) >= 500
  365. True
  366. >>> 'Etc/Greenwich' in all_timezones
  367. True
  368. ``common_timezones`` is a list of useful, current timezones. It doesn't
  369. contain deprecated zones or historical zones, except for a few I've
  370. deemed in common usage, such as US/Eastern (open a bug report if you
  371. think other timezones are deserving of being included here). It is also
  372. a sequence of strings.
  373. >>> from pytz import common_timezones
  374. >>> len(common_timezones) < len(all_timezones)
  375. True
  376. >>> 'Etc/Greenwich' in common_timezones
  377. False
  378. >>> 'Australia/Melbourne' in common_timezones
  379. True
  380. >>> 'US/Eastern' in common_timezones
  381. True
  382. >>> 'Canada/Eastern' in common_timezones
  383. True
  384. >>> 'Australia/Yancowinna' in all_timezones
  385. True
  386. >>> 'Australia/Yancowinna' in common_timezones
  387. False
  388. Both ``common_timezones`` and ``all_timezones`` are alphabetically
  389. sorted:
  390. >>> common_timezones_dupe = common_timezones[:]
  391. >>> common_timezones_dupe.sort()
  392. >>> common_timezones == common_timezones_dupe
  393. True
  394. >>> all_timezones_dupe = all_timezones[:]
  395. >>> all_timezones_dupe.sort()
  396. >>> all_timezones == all_timezones_dupe
  397. True
  398. ``all_timezones`` and ``common_timezones`` are also available as sets.
  399. >>> from pytz import all_timezones_set, common_timezones_set
  400. >>> 'US/Eastern' in all_timezones_set
  401. True
  402. >>> 'US/Eastern' in common_timezones_set
  403. True
  404. >>> 'Australia/Victoria' in common_timezones_set
  405. False
  406. You can also retrieve lists of timezones used by particular countries
  407. using the ``country_timezones()`` function. It requires an ISO-3166
  408. two letter country code.
  409. >>> from pytz import country_timezones
  410. >>> print(' '.join(country_timezones('ch')))
  411. Europe/Zurich
  412. >>> print(' '.join(country_timezones('CH')))
  413. Europe/Zurich
  414. Internationalization - i18n/l10n
  415. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  416. Pytz is an interface to the IANA database, which uses ASCII names. The `Unicode Consortium's Unicode Locales (CLDR) <http://cldr.unicode.org>`_
  417. project provides translations. Python packages such as
  418. `Babel <https://babel.pocoo.org/en/latest/api/dates.html#timezone-functionality>`_
  419. and Thomas Khyn's `l18n <https://pypi.org/project/l18n/>`_ package can be used
  420. to access these translations from Python.
  421. License
  422. ~~~~~~~
  423. MIT license.
  424. This code is also available as part of Zope 3 under the Zope Public
  425. License, Version 2.1 (ZPL).
  426. I'm happy to relicense this code if necessary for inclusion in other
  427. open source projects.
  428. Latest Versions
  429. ~~~~~~~~~~~~~~~
  430. This package will be updated after releases of the Olson timezone
  431. database. The latest version can be downloaded from the `Python Package
  432. Index <https://pypi.org/project/pytz/>`_. The code that is used
  433. to generate this distribution is hosted on Github and available
  434. using git::
  435. git clone https://github.com/stub42/pytz.git
  436. Announcements of new releases are made on
  437. `Launchpad <https://launchpad.net/pytz>`_, and the
  438. `Atom feed <http://feeds.launchpad.net/pytz/announcements.atom>`_
  439. hosted there.
  440. Bugs, Feature Requests & Patches
  441. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  442. Bugs should be reported on `Github <https://github.com/stub42/pytz/issues>`_.
  443. Feature requests are unlikely to be considered, and efforts instead directed
  444. to timezone support now built into Python or packages that work with it.
  445. Security Issues
  446. ~~~~~~~~~~~~~~~
  447. Reports about security issues can be made via `Tidelift <https://tidelift.com/security>`_.
  448. Issues & Limitations
  449. ~~~~~~~~~~~~~~~~~~~~
  450. - This project is in maintenance mode. Projects using Python 3.9 or later
  451. are best served by using the timezone functionaly now included in core
  452. Python and packages that work with it such as `tzdata <https://pypi.org/project/tzdata/>`_.
  453. - Offsets from UTC are rounded to the nearest whole minute, so timezones
  454. such as Europe/Amsterdam pre 1937 will be up to 30 seconds out. This
  455. was a limitation of the Python datetime library.
  456. - If you think a timezone definition is incorrect, I probably can't fix
  457. it. pytz is a direct translation of the Olson timezone database, and
  458. changes to the timezone definitions need to be made to this source.
  459. If you find errors they should be reported to the time zone mailing
  460. list, linked from http://www.iana.org/time-zones.
  461. Further Reading
  462. ~~~~~~~~~~~~~~~
  463. More info than you want to know about timezones:
  464. https://data.iana.org/time-zones/tz-link.html
  465. Contact
  466. ~~~~~~~
  467. Stuart Bishop <stuart@stuartbishop.net>