<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Tony Meyer wrote:<br>
<blockquote
cite="midECBA357DDED63B4995F5C1F5CBE5B1E86C3783@its-xchg4.massey.ac.nz"
type="cite">
<blockquote type="cite">
<pre wrap="">Index: _strptime.py
</pre>
</blockquote>
<pre wrap=""><!---->[...]
</pre>
<blockquote type="cite">
<pre wrap="">+ # 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
</pre>
</blockquote>
<pre wrap=""><!---->
Is this right? At the moment, if I ask for Monday in the 52nd week of 2008,
I get the 5th of January 2009:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">time.strptime("2008 52 1", "%Y %U %w")
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->(2009, 1, 5, 0, 0, 0, 0, 371, -1)
For reference, Monday in the previous week is the 22nd of December:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">time.strptime("2008 51 1", "%Y %U %w")
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->(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:
</pre>
</blockquote>
Yes, according to the Python documentation. You should however be aware
that this is different from the standard (ISO 8601:2000).<br>
According to that standard, Monday, week 52, 2008 is December 22.
Implementing a function that gives result different from what people<br>
actually use is not very good. It is better to leave it unimplemented.<br>
= Erik Andersen
<blockquote
cite="midECBA357DDED63B4995F5C1F5CBE5B1E86C3783@its-xchg4.massey.ac.nz"
type="cite">
<pre wrap=""></pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">time.strptime("2008 52 1", "%Y %U %w")
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->(2008, 12, 29, 0, 0, 0, 0, 364, -1)
This is with WinXP SP1.
=Tony Meyer
_______________________________________________
Python-Dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Python-Dev@python.org">Python-Dev@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/python-dev">http://mail.python.org/mailman/listinfo/python-dev</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/options/python-dev/python-erik%40rixmail.se">http://mail.python.org/mailman/options/python-dev/python-erik%40rixmail.se</a>
</pre>
</blockquote>
<br>
</body>
</html>