Working with Dates and Times in Python
The datetime module provides classes for working with dates and times. It's essential for tasks like logging, scheduling, calculating durations, or displaying formatted dates.
We'll cover the main classes (date, time, datetime, timedelta), formatting/parsing, arithmetic, and timezones.
Importing and Basic Objects
Creating Specific Dates/Times
Formatting with strftime
Convert datetime objects to strings with custom format.
Parsing with strptime
Date Arithmetic with timedelta
Quick Quiz
We have reviewed and checked the materials, but errors may still occur. The content is provided for educational purposes only, so use it at your own responsibility and verify with other sources if needed.
✨ Ask Lara — your AI study partner
Unlock personalized learning support. Lara can explain lessons, summarize topics, and answer your study questions — available from the Go plan and above.
Lara helps you learn faster — exclusive to ReadyTools Go, Plus, and Max members.


