bug report - time.strptime()

Kevin Ng kevin_ng at xoommail.com
Mon May 22 23:52:40 EDT 2000


Hi,

Below shows the behaviour of strptime. 

>>> s2='20000201'
>>> tup2=time.strptime(s2, '%Y%m%d')
>>> tup2
(2000, 1, 0, 0, 0, 0, 6, 1, 0)

>>> s3='00-020^H-01'
>>> s3='2000-02-01'
>>> tup3=time.strptime(s3,'%Y-%m-%d')
>>> tup3
(2000, 2, 1, 0, 0, 0, 6, 1, 0)

>>> s5='000201'
>>> tup5 = time.strptime(s5, '%y%m%d')
>>> tup5
(1900, 1, 0, 0, 0, 0, 6, 1, 0)

>>> s6='00 02 01' 
>>> tup6=time.strptime(s6, '%y %m %d')
>>> tup6
(1900, 2, 1, 0, 0, 0, 6, 1, 0)

Note the pattern is whenever the format string has no separation,
then strptime always return a date tuple of Jan 0 !?

My python version and platform :
Python 1.5.2 (#3, Jan 20 2000, 15:59:17)  [GCC egcs-2.90.29 980515
(egcs-1.0.3 re on linux2


Rgds
Kevin





More information about the Python-list mailing list