Python Quest

Track 10 · Lesson 3 of 12

Dates and times

Represent dates and times with datetime, do arithmetic with timedelta, format and parse text, and convert between time zones with zoneinfo.

About 45 minIntermediate4 exercises

You will be able to

  • Create date and datetime objects and read their parts
  • Add and subtract time with timedelta, and measure the gap between two dates
  • Format dates as text with strftime and parse text into dates with strptime and fromisoformat
  • Attach a time zone with zoneinfo and convert a moment between zones

Included with a Formula Quest membership

It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.