How to Get Current Weekday in Python

This tutorial shows how you can get the current weekday in Python with 2 examples.

Method 1: use weekday()

Method 2: use isoweekday()

Examples of getting current weekday in Python

Example 1 for method 1

We can also check which weekday it is using weekday(). It returns the day of the week as an integer, where Monday is 0 and Sunday is 6.

Week dayweekday()
Monday0
Tuesday1
Wednesday2
Thursday3
Friday4
Saturday 5
Sunday6
weekday() return value meanings in Python
import datetime
weekday_date = datetime.date.today().weekday()
print("weekday:", weekday_date)

Output:

weekday: 5

Example 2 for method 2

The function isoweekday() returns an integer to represent the day of the week. Different from weekday() in Example 1, isoweekday() returns 1 for Monday and 7 for Sunday.

Week dayisoweekday()
Monday1
Tuesday2
Wednesday3
Thursday4
Friday5
Saturday 6
Sunday7
isoweekday() return value meanings in Python
import datetime
weekday_date = datetime.date.today().isoweekday()
print(weekday_date)

Output:

4

Further Reading