Import Calendar Page
You can determine which day of the week a specific date falls on using weekday(year, month, day) . The result is a number where Monday is 0 and Sunday is 6.
Mastering Time Management in Python: A Comprehensive Guide to import calendar import calendar
# Check which day May 8, 2026 falls on day_index = calendar.weekday(2026, 5, 8) print(day_index) # Output: 4 (Friday) Use code with caution. Generating Date Lists You can determine which day of the week
print(calendar.isleap(2024)) # Output: True print(calendar.isleap(2026)) # Output: False Use code with caution. Finding Days of the Week 2026 falls on day_index = calendar.weekday(2026