A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-October/049461.html below:

[Python-checkins] python/dist/src/Lib _strptime.py, 1.35, 1.36

[Python-Dev] RE: [Python-checkins] python/dist/src/Lib _strptime.py, 1.35, 1.36Tony Meyer t-meyer at ihug.co.nz
Mon Oct 18 05:48:23 CEST 2004
> Index: _strptime.py
[...]
> +        # For some reason when Dec 31 falls on a Monday the 
> week of the year is
> +        # off by a week; verified on both OS X and Solaris.
> +        elif weekday == 0 and week_of_year_start == 6 and 
> week_of_year >= 52:
> +            week_of_year += 1

Is this right?  At the moment, if I ask for Monday in the 52nd week of 2008,
I get the 5th of January 2009:

>>> time.strptime("2008 52 1", "%Y %U %w")
(2009, 1, 5, 0, 0, 0, 0, 371, -1)

For reference, Monday in the previous week is the 22nd of December:

>>> time.strptime("2008 51 1", "%Y %U %w")
(2008, 12, 22, 0, 0, 0, 0, 357, -1)

Wouldn't December 29 2008 be the right answer? This is the result without
that if:

>>> time.strptime("2008 52 1", "%Y %U %w")
(2008, 12, 29, 0, 0, 0, 0, 364, -1)

This is with WinXP SP1.

=Tony Meyer

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4