ISO to datetime object: ‘z’ is a bad directive [duplicate]

Welcome to Python datetime! Dealing with dates and times is necessarily complex, and Python doesn’t come fully with batteries included in this case. You can’t use %z in strptime because Python has no classes to represent timezones (you are supposed to implement your own, or better yet include some other libraries).

You want to use pytz and python-dateutil. For more details see here:

Python strptime() and timezones?

Leave a Comment