[Fixed]-Datetime.strptime () throws 'does not match format' error

30👍

Try %d/%b/%Y:%H:%M:%S instead – %y right now means 11.

You can “debug” datetime formats easily using date (on the shell and not on python, I mean, assuming you’re running GNU/Linux or similar):

date '+%d/%b/%Y:%H:%M:%S'
05/May/2011:09:00:41

12👍

You’re checking for a 2 digit year ( %y ) instead of a four digit ( %Y )

6👍

You want %Y instead of %y. %Y means you want the century, %y is no century and the year is displayed from 00 to 99.

👤rtn

Leave a comment