Search code examples
pythonstrftime

ValueError: time data '2017-04-20 10:00:00-04:00' does not match format '%Y-%b-%d %H:%M:%S-%Z'


ValueError: time data '2017-04-20 10:00:00-04:00' does not match format '%Y-%b-%d %H:%M:%S-%Z'

I'm confused with the timezone part


Solution

  • The %b token is for an abbreviated month name. 04 isn't a name. %b expects something more like Apr. For a numeric month, use %m.