Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapping US zip code to time zone [closed]

When users register with our app, we are able to infer their zip code when we validate them against a national database. What would be the best way to determine a good potential guess of their time zone from this zip code?

We are trying to minimize the amount of data we explicitly have to ask them for. They will be able to manually set the time zone later if our best guess is wrong. I realize zip codes won't help with figuring out the time zone outside the US, but in that case we'd have to manually ask anyway, and we deal predominantly with the US regardless.

I've found a lot of zip code databases, and so far only a few contain time zone information, but those that do are not free, such as this one. If it's absolutely necessary to pay a subscription to a service in order to do this, then it will not be worth it and we will just have to ask users explicitly.

Although language isn't particularly relevant as I can probably convert things however needed, we're using PHP and MySQL.

like image 949
Doug Kavendek Avatar asked Mar 16 '10 16:03

Doug Kavendek


People also ask

Can ZIP codes cross time zones?

Yes. In theory, postal code boundaries and time zone boundaries are separate entities, and thus their can be oddities like one postal code with multiple time zones. It is possible.

Can you map ZIP codes on Google Maps?

Yes. If you right-click on a place in Google Maps then choose “What's here” in the pop-up box, a new box will be displayed that shows the location with an address including a zip code/postal code.

Do any ZIP codes overlap States?

ZIP codes can and do cross state lines (rarely, but just enough to cause some problems and confusion), county lines (about 10% of ZIPs are in more than one county), political jurisdictions (cities, congressional districts), metro areas, etc.

What is timezone map?

The world time zone map indicates the standard time zones actually observed. In theory time zones are based on the division of the world into twenty four time zones of 15 degrees longitude each.


1 Answers

I just found a free zip database that includes time offset and participation in DST. I do like Erik J's answer, as it would help me choose the actual time zone as opposed to just the offset (because you never can be completely sure on the rules), but I think I might start with this, and have it try to find the best time zone match based on offset/dst configuration. I think I may try to set up a simple version of Development 4.0's answer to check against what I get from the zip info as a sanity test. It's definitely not as simple as I'd hope, but a combination should get me at least 90% sure of a user's time zone.

like image 116
Doug Kavendek Avatar answered Sep 22 '22 07:09

Doug Kavendek