trouble with time --again

Kristian Zoerhoff kristian.zoerhoff at gmail.com
Tue Aug 30 13:50:55 EDT 2005


On 30 Aug 2005 10:42:41 -0700, nephish at xit.net <nephish at xit.net> wrote:
> Hey there,
> could someone show me where i am going wrong here?
> 
> >>> date1 = '2005-01-01 8:20:00'
> >>> date1 = strptime('%Y-%m-%d %H:%M:%S',date1)
> 
> raise ValueError("time data did not match format:  data=%s  fmt=%s" %
> ValueError: time data did not match format:  data=%Y-%m-%d%H:%M:%S
> fmt=2005-01-01 8:20:00

Try:

>>> date1 = strptime(date1, '%Y-%m-%d %H:%M:%S')

I think you have the data and format strings swapped.

-- 
Kristian

kristian.zoerhoff(AT)gmail.com
zoerhoff(AT)freeshell.org



More information about the Python-list mailing list