Learn datetime
Dates, times, durations and time zones in the standard library
The datetime module provides date, time, datetime and timedelta types for calendar arithmetic, formatting and parsing, and together with zoneinfo it handles real-world time zones and daylight saving time. Scheduling, logging, billing, analytics and every API that exchanges timestamps depend on getting it right. It rewards care: naive versus aware values and DST transitions are classic sources of bugs.
Before you start
How deep do you want to go?
1. EssentialsRead and write simple code, do the everyday basics
2. PracticalUse it productively at work, with the usual idioms
3. AdvancedThe less common features, performance and trade-offs
4. ExpertInternals and the edge cases experts know