Message135177
Python is via datetime.isocalendar() able to produce the ISO week number and ISO weekday from a given date. But it is not possible to do the reverse; calculate the date from a year, ISO week number and weekday.
libc strptime()/strftime() mentions a %V and %u directive which does this, i.e. Monday in ISO week 22 of the year 2011:
datetime.strptime('2011221', '%Y%V%u')
returning 2011-05-30 and
datetime.strptime('2011227', '%Y%V%u')
returning 2011-06-05
libc (on FreeBSD) has this to say:
%V is replaced by the week number of the year (Monday as the first day
of the week) as a decimal number (01-53). If the week containing
January 1 has four or more days in the new year, then it is week 1;
otherwise it is the last week of the previous year, and the next
week is week 1.
%u is replaced by the weekday (Monday as the first day of the week) as
a decimal number (1-7). |
|
Date |
User |
Action |
Args |
2011-05-05 10:03:43 | Erik.Cederstrand | set | recipients:
+ Erik.Cederstrand |
2011-05-05 10:03:43 | Erik.Cederstrand | set | messageid: <1304589823.43.0.534219095158.issue12006@psf.upfronthosting.co.za> |
2011-05-05 10:03:42 | Erik.Cederstrand | link | issue12006 messages |
2011-05-05 10:03:42 | Erik.Cederstrand | create | |
|