Cannot parse the date in Python -


i need parse date , time. here i've got:

import time = time.strptime('apr 28 2013 23:01', "%b %d %y %h:%m") print  

but gives me

traceback (most recent call last):   file "/home/aaa/documents/python_test.py", line 17, in <module>     = time.strptime('apr 28 2013 23:01', "%b %d %y %h:%m")   file "/usr/lib/python2.7/_strptime.py", line 467, in _strptime_time     return _strptime(data_string, format)[0]   file "/usr/lib/python2.7/_strptime.py", line 325, in _strptime     (data_string, format)) valueerror: time data 'apr 28 2013 23:01' not match format '%b %d %y %h:%m' 

what doing wrong?

%y should %y 4 digit year...

from docs:

%y  year without century decimal number [00,99].     %y  year century decimal number. 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -