Python: What day of the week today?

Today (2020-09-19) is Saturday but how can we get the value in Python? Before explaining, let's see Python calendar package.

import calendar

days = calendar.day_name
days_list = list(days)

# <calendar._localized_day object at 0x117b172b0>

# ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']

calendar.day_name itself is not a list but can be cast to a list from Monday to Sunday.

What day of the week today?

import calendar
import datetime

today =

print(today)  # 2020-09-19
print(type(today))  # <class ''>

weekday = today.weekday()

print(weekday)  # 5
print(type(weekday))  # <class 'int'>

day_name = calendar.day_name[weekday]

# Saturday

today returns the today object. weekday is an index of day_name.

Python Date & Time

Python Tutorial