[ python-Bugs-1496315 ] strptime: wrong default values used to fill in missing data

SourceForge.net noreply at sourceforge.net
Sun May 28 11:26:14 CEST 2006


Bugs item #1496315, was opened at 2006-05-28 11:26
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1496315&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Markus Gritsch (markus_gritsch)
Assigned to: Nobody/Anonymous (nobody)
Summary: strptime: wrong default values used to fill in missing data

Initial Comment:
The documentation of strptime() says: """The default
values used to fill in any missing data are (1900, 1,
1, 0, 0, 0, 0, 1, -1)""".  As the example below shows,
this is not the case.

Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for
more information.
>>> import time
>>> time.strptime('', '')
(1900, 1, 1, 0, 0, 0, 0, 1, -1)
>>> time.strptime('2006', '%Y')
(2006, 1, 1, 0, 0, 0, 6, 1, -1)
>>> time.strptime('2006-05', '%Y-%m')
(2006, 5, 1, 0, 0, 0, 0, 121, -1)
>>> time.strptime('2006-05-26', '%Y-%m-%d')
(2006, 5, 26, 0, 0, 0, 4, 146, -1)
>>> time.strptime('2006-05-26 21', '%Y-%m-%d %H')
(2006, 5, 26, 21, 0, 0, 4, 146, -1)
>>> time.strptime('2006-05-26 21:06', '%Y-%m-%d %H:%M')
(2006, 5, 26, 21, 6, 0, 4, 146, -1)
>>> time.strptime('2006-05-26 21:06:11', '%Y-%m-%d
%H:%M:%S')
(2006, 5, 26, 21, 6, 11, 4, 146, -1)


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1496315&group_id=5470


More information about the Python-bugs-list mailing list