Courses/Data Formats & Networking

๐ŸŒ Data Formats & Networking

Dates & Times

datetime, timedelta, and ISO formatting.

Use datetime for points in time and timedelta for durations. isoformat() gives a sortable string.

from datetime import datetime, timedelta

now = datetime(2024, 6, 15, 12, 0)
later = now + timedelta(days=7, hours=3)
print(later.isoformat())
main.py
Output
Press Run to execute.
Expected output
365

Sign in to track your progress across lessons.