0

Task: Given every zipcode of locations in US, I need to get the exact utf_timeoffset and exact dst(daytime savings offset), but I can ignore zip_code belonging to AP/FPO/DPO.

I need take into account of the timezone differences inside each state, and also need care about the exception of Hawaii, Arizona and several zipcode in PR, VI when it comes to daylight savings between Mar 11 2013, 2:00 and Nov 3 2013, 2:00.

I wonder if there is a standard module existing in Pytz(the famous timezone s/w package), because I can't located any proper function with zip_code parameter. Besides, I am perfectly fine with other package than pytz, and also any other programming languages other than Python.

At the same time, with some handmade code, I have managed to get "time_zone name" and "utf_time offset" for each zip_code. Based on provision of some websites, I also managed to get a copy of dataset containing zip_code and their daylight savings flag. A.K.A the current dst policy for each zip_code in US)

So far It works fine, but I dont really trust my own code, didn't get a way to validate its correctness.

Lennart Regebro
  • 167,292
  • 41
  • 224
  • 251
Joshua
  • 1
  • 1

2 Answers2

0

No, pytz do not have such a functionality. See also: Mapping US zip code to time zone

Community
  • 1
  • 1
Lennart Regebro
  • 167,292
  • 41
  • 224
  • 251
0

Do you have the option to use the raw ZIP code data? Because if you do, it might be very helpful to use a zip code database such as the kind you would find here. They have the ZIP code associated with specific time zones as well as daylight savings info for each one. Looks like the annual price is currently $139 for 12 monthly updates.

I don't work there but I know a lot about ZIP codes and addresses since I work at SmartyStreets.

Jeffrey
  • 502
  • 2
  • 10