Mapping US zip code to time zone
Posted
by Doug Kavendek
on Stack Overflow
See other posts from Stack Overflow
or by Doug Kavendek
Published on 2010-03-16T16:46:39Z
Indexed on
2010/03/16
16:51 UTC
Read the original article
Hit count: 286
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.
© Stack Overflow or respective owner