I am getting this exception
time data did not match format: data=19:51:06 Jan 17, 2011 PST fmt=%H:%M:%S %b %d, %Y %Z
for following code
datetime.strptime(parameters['19:51:06 Jan 17, 2011 PST'], "%H:%M:%S %b %d, %Y %Z")
in python code running on Google app engine.
How to modify the forma开发者_JS百科tter so that it works?
Look for the python docs for datetime.strptime [1]. They say it uses time.strptime internally, so let's check there [2].
Support for the %Z directive is based on the values contained in tzname and whether daylight is true. Because of this, it is platform-specific except for recognizing UTC and GMT which are always known (and are considered to be non-daylight savings timezones).
You should go and check out the excellent pytz library [3].
[1] http://docs.python.org/library/datetime.html#datetime.datetime.strptime
[2] http://docs.python.org/library/time.html#time.strptime
[3] http://pytz.sourceforge.net/
精彩评论