Just had an interesting case: Wanted to parse a timestamp, it raised an error (“Value Error: Time data does not match format”).

The problem was the timezone: I hard coded "...+0100" as the format string, as this was the obvious extension to all our timestamps. I forgot that we have this damm summer time giving us +0200 between march and september (or so)…

Learnings

  • Time Zones are important. Particularly if you are living in Austria.
  • I do not want to hard-code a time zone when parsing a time string.
  • When using Python’s datetime module with the .strftime() or .strptime() method, there exists the %z placeholder which adds +MMSS or -MMSS, based on the current time zone.