Skip to content

Commit 77e0396

Browse files
committed
Add What's New entry for zoneinfo
1 parent 8b10cb3 commit 77e0396

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

Doc/whatsnew/3.9.rst

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,46 @@ Other Language Changes
205205
New Modules
206206
===========
207207

208-
* None yet.
208+
.. _whatsnew39-pep615:
209+
210+
zoneinfo
211+
--------
212+
213+
The :mod:`zoneinfo` module brings support for the IANA time zone database to
214+
the standard library. It adds :class:`zoneinfo.ZoneInfo`, a concrete
215+
:class:`datetime.tzinfo` implementation backed by the system's time zone data.
216+
217+
Example::
218+
219+
>>> from zoneinfo import ZoneInfo
220+
>>> from datetime import datetime, timedelta
221+
222+
>>> # Daylight saving time
223+
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
224+
>>> print(dt)
225+
2020-10-31 12:00:00-07:00
226+
>>> dt.tzname()
227+
'PDT'
228+
229+
>>> # Standard time
230+
>>> dt += timedelta(days=7)
231+
>>> print(dt)
232+
2020-11-07 12:00:00-08:00
233+
>>> print(dt.tzname())
234+
PST
235+
236+
237+
As a fall-back source of data for platforms that don't ship the IANA database,
238+
the |tzdata|_ module was released as a first-party package -- distributed via
239+
PyPI and maintained by the CPython core team.
240+
241+
.. |tzdata| replace:: ``tzdata``
242+
.. _tzdata: https://pypi.org/project/tzdata/
243+
244+
.. seealso::
245+
246+
:pep:`615` -- Support for the IANA Time Zone Database in the Standard Library
247+
PEP written and implemented by Paul Ganssle
209248

210249

211250
Improved Modules

0 commit comments

Comments
 (0)