How do you reconstruct a log date from ISO year, week and weekday?

fromisocalendar constructs a calendar date from all three ISO week-date components, with Monday numbered one.

Python example and interpretation

Monday of ISO week one of 2025 falls on December 30, 2024. Keep both week year and weekday; a week number alone cannot recover the date.

from datetime import date
date.fromisocalendar(2025,1,1).isoformat()

Result '2024-12-30'

中文

只有 ISO 周年、周号和星期时,怎样还原日志日期?

fromisocalendar 接受 ISO 周日期的三个分量并返回对应的日历日期,星期一编号为一。

Python 算例与适用条件

2025 年第一周的星期一是 2024 年 12 月 30 日。导入周报时要保留 ISO 周年和星期,单凭周号不足以还原日期。

from datetime import date
date.fromisocalendar(2025,1,1).isoformat()

结果 '2024-12-30'

References / 参考来源

Keep reading / 继续阅读