METADATA 20 KB

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