The Python datetime.isocalendar() method returns a tuple (ISO_year, ISO_week_number, ISO_weekday) for the given datetime object. Is there a corresponding inverse function? If not, is there an easy way to compute a date given a year, week number and day of the week?
The Python datetime.isocalendar() method returns a tuple (ISO_year, ISO_week_number, ISO_weekday) for the given datetime
Share
Python 3.8 added the fromisocalendar() method:
Python 3.6 added the
%G,%Vand%udirectives:Original answer
I recently had to solve this problem myself, and came up with this solution:
A few test cases: