From the course: Learning Python
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
The date, time, and datetime classes - Python Tutorial
From the course: Learning Python
The date, time, and datetime classes
- [Instructor] Just about every programmer has to work with dates and times at some point. In this chapter, we're going to start by learning about some of the Python classes that are available for this purpose. So let's open up in chapter five, the Dates Start file and those of you using CoLab can just create a new code cell. So in order to get this rich date and time functionality, we of course have to import the necessary modules and classes from the standard library, and we saw how to do that earlier in the course. So here you can see I've got the from date time import date, and from datetime import datetime classes. So let's go ahead and copy and paste these into our CoLab starting point. So I'm going to make use of the date and datetime classes in this example, both of which are part of the Python standard library. Now, the second import here might be a little confusing. There's actually a class named datetime inside the module named datetime. So to be clear, that's what I'm…