django - Python DateTime Format Error -


i new @ python. trying play time , date objects. wrote simple test program parse string specific time format. throwing valueerror. can please me out here?

here code:

import time testdate = "tuesday, febuary 23 2011 12:00:00 utc" today = time.strptime(testdate,"%a, %b %d %y %h:%m:%s %z") print today 

and error:

traceback (most recent call last):   file "d:\python\pythontest\src\helloworld.py", line 3, in <module>     today = time.strptime(testdate,"%a, %b %d %y %h:%m:%s %z")   file "c:\python27\lib\_strptime.py", line 467, in _strptime_time     return _strptime(data_string, format)[0]   file "c:\python27\lib\_strptime.py", line 325, in _strptime    (data_string, format)) valueerror: time data 'tuesday, febuary 23 2011 12:00:00 utc' not match format '%a, %b %d %y %h:%m:%s %z' 

you had february misspelled. code works.

import time testdate = "tuesday, february 23 2011 12:00:00 utc" today = time.strptime(testdate,"%a, %b %d %y %h:%m:%s %z") print today 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -