Python date.isoweekday() Method

Beginner
6 min read
Updated: Nov 2026
3 examples
date method

Definition

isoweekday() returns the ISO 8601 weekday number: 1 for Monday up to 7 for Sunday.

It is always weekday() plus one, and it is the third value returned by isocalendar(). The time of day and the time zone do not matter: it only looks at the date fields.

date.isoweekday() is an instance method of datetime.date: call it on an existing object with dot notation, such as day.isoweekday(...). Import the class first, for example from datetime import date. The datetime class has a method with the same name.

Syntax

Call it with no arguments.

python
number = day.isoweekday()
CallWhat it does
date(2024, 3, 15).isoweekday()Returns 5: Friday.
date(2024, 3, 17).isoweekday()Returns 7: Sunday.
datetime(2024, 1, 1, 23, 0).isoweekday()Returns 1: Monday.

Weekend test: day.isoweekday() >= 6 is True on Saturday and Sunday.

Method signatures
python
date.isoweekday()
datetime.isoweekday()
# returns: int, 1 (Monday) .. 7 (Sunday)

Parameters

isoweekday() takes no parameters.

Return Value

Return ValueDescription
int1 for Monday through 7 for Sunday.

Python Examples

Example 1 — Compare isoweekday() with weekday()

Print both numbers for a Friday, then the ISO number for a Sunday.

python
from datetime import date

day = date(2024, 3, 15)
print(day.isoweekday())
print(day.weekday())
print(date(2024, 3, 17).isoweekday())

How It Works

  1. Monday is 1. Friday is the fifth ISO day, so the result is 5.
  2. Off by one. weekday() starts at 0, so it returns 4 for the same Friday.
  3. Sunday is 7. The ISO scale ends with Sunday as day 7.

Example 2 — Map Weekday Numbers to Names Without the Locale

Use your own list of names so the output never depends on locale settings. Index with isoweekday() - 1.

python
from datetime import date

NAMES = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
for day in (date(2000, 1, 1), date(2000, 2, 29), date(2038, 1, 19)):
    print(day, NAMES[day.isoweekday() - 1])

How It Works

  1. Fixed list. A Python list gives the same English names on every machine, unlike %a.
  2. Shift to zero. Subtracting 1 turns the ISO range 1 to 7 into list indexes 0 to 6.
  3. Famous dates. 1 January 2000 was a Saturday, and 19 January 2038, when 32-bit Unix time overflows, is a Tuesday.

Example 3 — Count Working Days in a Two-Week Range

Build 14 consecutive days and keep the ones with an ISO number of 5 or less.

python
from datetime import date, timedelta

start = date(2024, 3, 1)
days = [start + timedelta(days=i) for i in range(14)]
working = [d for d in days if d.isoweekday() <= 5]
print(len(working))
print(working[0], working[-1])
print(sum(1 for d in days if d.isoweekday() in (6, 7)))

How It Works

  1. Date range. Adding 0 to 13 days to 1 March gives the dates up to 14 March.
  2. Monday to Friday. ISO numbers 1 to 5 are working days, giving 10 of them.
  3. Weekends. Numbers 6 and 7 mark the two Saturdays and two Sundays.

Frequently Asked Questions

1. Sunday is 7.
weekday() returns 0 to 6 starting Monday; isoweekday() returns 1 to 7 starting Monday.
day.isoweekday() >= 6, or day.weekday() >= 5.
Use day.strftime("%A") for the locale name, or index your own list with isoweekday() - 1.
No, it uses the date fields only. Convert an aware datetime to the zone you care about first.

Next: datetime.now()

Classmethod: the current date and time, naive local or aware with tz.

now() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful