Arrrgh, #Python. I was wondering why my timestamps were parsed wrong. I was using the datetime.strptime() format code %Z, documented as "Time zone name (empty string if the object is naive)".

But what it *actually* does is check that it is given a valid time zone name, then throw that information away and return a naive datetime object anyway.

If you want to use time zone information, use "+HHMM" and parse it with "%z". Alternatively, throw Python into the fiery pits of Hell where it belongs.

Follow

@Creideiki check out "arrow" package on pypi for a more sane datetime alternative :)

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.