[New-bugs-announce] [issue12006] strptime should implement %V or %u directive from libc
Erik Cederstrand
report at bugs.python.org
Thu May 5 12:03:43 CEST 2011
New submission from Erik Cederstrand <ec at 1calendar.dk>:
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).
----------
components: Library (Lib)
messages: 135177
nosy: Erik.Cederstrand
priority: normal
severity: normal
status: open
title: strptime should implement %V or %u directive from libc
type: feature request
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12006>
_______________________________________
More information about the New-bugs-announce
mailing list