Handling Datetimes with Timezones

Python’s datetime module allows your programs to manipulate dates and times in high-level ways. You can, for example, use arithmetic to calculate the difference between dates and advance dates forward and backward through time.

This section introduces a particularly thorny part of the datetime library: dealing with timezones. You won’t need to know the ins and outs of the datetime module to follow along with this section, but feel free to consult the Python datetime docs if you are interested.[79]

Using datetime with and without Timezones

Python provides the datetime object to represent specific points in time (for example, October 11th 2020 at 7:42 p.m.). By design, Python allows users to work with two variants ...

Get Intuitive Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.