Python date.fromisocalendar() Method

Beginner
6 min read
Updated: Nov 2026
3 examples
classmethod

Definition

date.fromisocalendar(year, week, day) returns the date for an ISO 8601 week date: the ISO year, the week number (1 to 52 or 53), and the weekday where Monday is 1 and Sunday is 7.

ISO week 1 is the week that contains the year's first Thursday, so it can start in late December. This method is the inverse of isocalendar(). datetime.fromisocalendar() returns the same day at midnight.

date.fromisocalendar() is a classmethod of datetime.date: call it on the class itself, as date.fromisocalendar(...), and it returns a new object. Import the class first, for example from datetime import date. The datetime class has a method with the same name. Added in Python 3.8.

Syntax

Pass the ISO year, the week number, and the weekday number.

python
day = date.fromisocalendar(year, week, day)
moment = datetime.fromisocalendar(year, week, day)
CallWhat it does
date.fromisocalendar(2024, 1, 1)Returns datetime.date(2024, 1, 1): Monday of week 1.
date.fromisocalendar(2025, 1, 1)Returns datetime.date(2024, 12, 30): ISO 2025 starts in December 2024.
datetime.fromisocalendar(2024, 11, 5)Returns datetime.datetime(2024, 3, 15, 0, 0): Friday of week 11.

The weekday follows isoweekday() numbering (Monday 1 to Sunday 7), not weekday() (Monday 0).

Method signatures
python
classmethod date.fromisocalendar(year, week, day)
classmethod datetime.fromisocalendar(year, week, day)
# week: 1..52, or 53 in long ISO years; day: 1 (Monday) .. 7 (Sunday)

Parameters

ParameterDescription
yearThe ISO year, 1 to 9999. It can differ from the calendar year near 1 January.
weekThe ISO week, 1 to 52, or 53 in years that have 53 ISO weeks.
dayThe ISO weekday, 1 (Monday) to 7 (Sunday).

Return Value

Return ValueDescription
dateThe calendar date for that ISO week date (a datetime at midnight from the datetime version).

Python Examples

Example 1 — Convert ISO Week Dates to Calendar Dates

Convert Monday of week 1 in 2024 and 2025, and Friday of week 11 in 2024.

python
from datetime import date

print(date.fromisocalendar(2024, 1, 1))
print(date.fromisocalendar(2024, 11, 5))
print(date.fromisocalendar(2025, 1, 1))

How It Works

  1. Aligned year. 1 January 2024 is a Monday, so ISO week 1 of 2024 starts on that exact day.
  2. Week and weekday. Week 11, day 5 counts 10 full weeks plus four days from 1 January, reaching Friday 15 March.
  3. Year boundary. ISO week 1 of 2025 contains Thursday 2 January, so its Monday is 30 December 2024.

Example 2 — Print Monday-to-Sunday Ranges for Planning

Build a helper that returns the first and last day of an ISO week, then print three weeks of 2026.

python
from datetime import date


def week_range(year, week):
    monday = date.fromisocalendar(year, week, 1)
    sunday = date.fromisocalendar(year, week, 7)
    return monday, sunday


for week in (1, 26, 52):
    start, end = week_range(2026, week)
    print(f"2026-W{week:02d}: {start} to {end}")

How It Works

  1. Monday and Sunday. Days 1 and 7 of the same ISO week give its first and last date.
  2. Week 1 starts early. 2026 begins on a Thursday, so its week 1 runs from 29 December 2025.
  3. Zero-padded label. {week:02d} prints week numbers as two digits, matching the ISO YYYY-Www style.

Example 3 — Detect Years That Have a Week 53

Ask for week 53 in three years and catch the ValueError for the year that only has 52 ISO weeks.

python
from datetime import date

for year in (2020, 2021, 2026):
    try:
        print(year, date.fromisocalendar(year, 53, 1))
    except ValueError:
        print(year, "has no week 53")

How It Works

  1. Leap year rule. 2020 starts on a Wednesday and is a leap year, which gives it 53 ISO weeks.
  2. Short year. 2021 starts on a Friday, so week 53 does not exist and Python raises ValueError.
  3. Thursday start. 2026 begins on a Thursday, the other way to get a 53rd week.

Frequently Asked Questions

Use date.fromisocalendar(year, week, 1) for the Monday of that week (Python 3.8+).
ISO week 1 is the week containing the first Thursday of the year, so its Monday can fall in late December.
Years that start on a Thursday, and leap years that start on a Wednesday, such as 2020 and 2026.
isocalendar(), which returns the (year, week, weekday) triple for a date.
datetime.strptime(f"{year}-{week}-{day}", "%G-%V-%u") gives the same result on 3.6 and 3.7.

Next: datetime.fromisoformat()

Classmethod: parse ISO 8601 text such as 2024-03-15T10:30:00+05:30.

fromisoformat() →

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.

13 people found this page helpful