ukndoit has asked for the wisdom of the Perl Monks concerning the following question:

Is there a way to get the timezone someone lives in by their IP address or area code of their phone number? I have been searching for a way, but have not had a lot of time to filter through all the results.

The reason we need this is that our Member have requested we give them a phone call by our automated systems when they have certain events, such as new orders, new referalls and so forth, however, we don't want those calls to go out during the night, so need a way to validate the timezone to have the system skip the call if it us during the off hours.

Thank you very much Xav
  • Comment on seeking a way to get timezone from members on fly

Replies are listed 'Best First'.
Re: seeking a way to get timezone from members on fly
by ikegami (Patriarch) on Sep 15, 2009 at 02:34 UTC
    Why don't you ask them for their time zone and for the best time to contact them when they give you their phone number? (There are two people who work night shifts in this household...) You can use DateTime to convert those times into your local time zone.
Re: seeking a way to get timezone from members on fly
by dsheroh (Monsignor) on Sep 15, 2009 at 07:59 UTC
    There are databases that can be used to try to look that sort of thing up, but they won't always be right. I, for instance, have a phone number with a 612 area code (Minneapolis, Minnesota), but I live in Sweden. I have also been known on occasion to route my traffic through a US-based proxy so that IP-based geolocation will think I'm in the States.

    Ask your users for their time zone. It's the only way to get reliable results.

Re: seeking a way to get timezone from members on fly
by jethro (Monsignor) on Sep 15, 2009 at 12:35 UTC

    A crude mapping of IP to registry can be found in the web comic http://xkcd.com/195/. But as everyone already said any such mapping is not as accurate as you would like

Re: seeking a way to get timezone from members on fly
by ww (Archbishop) on Sep 15, 2009 at 01:59 UTC

    So you expect us to expend the time to filter your results?

    Uh.... NO!

    But, you could consult your local phone book (sorry, US location assumed; may be true elsewhere) and its map (or list) of A/Cs and their geography. Then you can create a HOA with TZs as keys and the A/Cs in the arrays.

    The A/C - TZ pairing should not be off by more than an hour.*

    Coding is left as an exercise....

    BTW, since you appear to have first visited the Monastery in 2004, you may want to refresh your understanding of local customs by (re?)reading On asking for help and How do I post a question effectively?.

    * Update: Note (as in replies below) that this sentence should end with something like "... than an hour, in most cases."