0

I have a IP geolocation service that returns the users estimated timezone in the format of -08:00

At first I tried to dump this number into Pytz, but that doesn't work. (I realize now that was a stupid idea.)

So how might I parse this number into a tzinfo object?

Theron Luhn
  • 3,974
  • 4
  • 37
  • 49

1 Answers1

0

An offset is not enough to define a timezone, e.g., it ignores DST and other changes to the time in the area.

To get a limited tzinfo object you could use pytz.FixedOffset(-8*60).

jfs
  • 399,953
  • 195
  • 994
  • 1,670