Python timezone ‘%z’ directive for datetime.strptime() not available

strptime() is implemented in pure Python. Unlike strftime(); it [which directives are supported] doesn’t depend on platform. %z is supported since Python 3.2: >>> from datetime import datetime >>> datetime.strptime(’24/Aug/2014:17:57:26 +0200′, ‘%d/%b/%Y:%H:%M:%S %z’) datetime.datetime(2014, 8, 24, 17, 57, 26, tzinfo=datetime.timezone(datetime.timedelta(0, 7200))) how to parse Email time zone indicator using strptime() without being aware of locale … Read more

Why doesn’t pytz localize() produce a datetime object with tzinfo matching the tz object that localized it?

They are the same time zone – “Europe/Berlin”. When you are printing them, the output includes the abbreviation and offset that applies at that particular point in time. If you examine the tz data sources, you’ll see: # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Europe/Berlin 0:53:28 – LMT 1893 Apr 1:00 C-Eur CE%sT 1945 … Read more

TZInfo::DataSourceNotFound error starting Rails v4.1.0 server on Windows

Resolving the Error To resolve this error, you’ll need to make sure that the tzinfo-data gem is being included in your Gemfile. First of all, check your Gemfile to see if there is an existing reference to tzinfo-data. If there isn’t already a reference, then add the following line: gem ‘tzinfo-data’ You may find that … Read more