Skip to content
Advertisement

Tag: timezone

Weird timezone issue with pytz

A seven hour and 37 minute offset? This is a little strange, does anyone experience the same issue? In fact I’m getting different behavior between Answer Time zones and offsets change over the years. The default zone name and offset delivered when pytz creates a timezone object are the earliest ones available for that zone, and sometimes they can seem

How can I get a human-readable timezone name in Python?

In a Python project I’m working on, I’d like to be able to get a “human-readable” timezone name of the form America/New_York, corresponding to the system local timezone, to display to the user. Every piece of code I’ve seen that accesses timezone information only returns either a numeric offset (-0400) or a letter code (EDT) or sometimes both. Is there

Python – calendar.timegm() vs. time.mktime()

I seem to have a hard time getting my head around this. What’s the difference between calendar.timegm() and time.mktime()? Say I have a datetime.datetime with no tzinfo attached, shouldn’t the two give the same output? Don’t they both give the number of seconds between epoch and the date passed as a parameter? And since the date passed has no tzinfo,

Advertisement