The datetime Module

We will be learning about the following classes from the datetime module:

  • datetime.timedelta
  • datetime.datetime

These will cover the majority of instances where you’ll need to use date and datetime object in Python. There is also a tzinfo class for working with time zones that we won’t be covering. Feel free to take a look at the Python documentation for more information on that class.

Python can represent dates several different ways. We’re going to look at the format first as it happens to be one of the simpler date objects.

Get hands-on with 1200+ tech skills courses.