O'Reilly logo

The Python 3 Standard Library by Example, Second Edition by Doug Hellmann

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Dates and Times

Python does not include native types for dates and times as it does for int, float, and str, but it provides three modules for manipulating date and time values in several representations.

The time (page 211) module exposes the time-related functions from the underlying C library. It includes functions for retrieving the clock time and the processor run time, as well as basic parsing and string formatting tools.

The datetime (page 221) module provides a higher-level interface for date, time, and combined values. The classes in datetime support arithmetic, comparison, and time zone configuration.

The calendar (page 233) module creates formatted representations of weeks, months, and years. It can also be used to compute ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required