[Python-Dev] Checking input range in time.asctime and time.ctime

Glyph Lefkowitz glyph at twistedmatrix.com
Wed Jan 5 23:14:18 CET 2011

On Jan 5, 2011, at 4:33 PM, Guido van Rossum wrote:

> Shouldn't the logic be to take the current year into account? By the
> time 2070 comes around, I'd expect "70" to refer to 2070, not to 1970.
> In fact, I'd expect it to refer to 2070 long before 2070 comes around.
> All of which makes me think that this is better left to the app, which
> can decide for itself whether it is more important to represent dates
> in the future or dates in the past.

The point of this somewhat silly flag (as I understood its description earlier in the thread) is to provide compatibility with POSIX 2-year dates.  As per http://pubs.opengroup.org/onlinepubs/007908799/xsh/strptime.html - 

is the year within century. When a century is not otherwise specified, values in the range 69-99 refer to years in the twentieth century (1969 to 1999 inclusive); values in the range 00-68 refer to years in the twenty-first century (2000 to 2068 inclusive). Leading zeros are permitted but not required.

So, "70" means "1970", forever, in programs that care about this nonsense.

Personally, by the time 2070 comes around, I hope that "70" will just refer to 70 A.D., and get you odd looks if you use it in a written date - you might as well just write '0' :).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110105/d8748be6/attachment-0001.html>

More information about the Python-Dev mailing list