Rjay155 Rjay155 - 2 months ago 4x
Python Question

Unable to convert strptime properly

I was trying to take a string such as '2016-07-30T20:00:00' and convert it via

(string, '%Y-%d-%mT%H:%M:%S')

but I keep getting the error...

time data '2016-07-30T20:00:00' does not match format '%Y-%d-%mT%H:%M:%S'

when I had a string such as '2016-08-08T00:00:00' it would work but I'm not sure whats causing the error for the example above.


Clearly, you swapped between the month and the days, use:

(string, '%Y-%m-%dT%H:%M:%S')
#           --^--^--