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)
|