homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Erik.Cederstrand
Recipients Erik.Cederstrand
Date 2011年05月05日.10:03:42
SpamBayes Score 8.54734e-06
Marked as misclassified No
Message-id <1304589823.43.0.534219095158.issue12006@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2011年05月05日 10:03:43Erik.Cederstrandsetrecipients: + Erik.Cederstrand
2011年05月05日 10:03:43Erik.Cederstrandsetmessageid: <1304589823.43.0.534219095158.issue12006@psf.upfronthosting.co.za>
2011年05月05日 10:03:42Erik.Cederstrandlinkissue12006 messages
2011年05月05日 10:03:42Erik.Cederstrandcreate

AltStyle によって変換されたページ (->オリジナル) /