Convert Local time based on area code

Posted on 2011-05-12
Last Modified: 2012-05-11

I am trying to find a way to determine when a fax was sent local time.  

I have the time the fax was received and the phone number (including the area code) that the fax was sent from.  Is it possible to determine when the fax was sent?

In PA(area code 412) the fax was received from Texas (area code 281) at 3:00 PM, so when the fax was sent it was 2:00PM in Texas.

Any help is appreciated.

Thank you
Question by:MeowserM
    LVL 10

    Assisted Solution

    I suggest:
    1. You capture the area code from the originating phone/fax number in your program.
    2. Call a web service to get the time zone for the number
    (Example:, operation: GetInfoByAreaCode)
    3. Offset the time of receive by the time zone difference between your location and the origin of the phone/Fax

    I can write a sample piece of code, if needed.

    Author Comment

    Do you know where I could get a table that has the area code and time zone
    281   Central
    724   Eastern
    412   Eastern

    Instead of using the webservice?

    LVL 92

    Assisted Solution

    by:Patrick Matthews

    That table wouldn't be enough.  You would also have to know whether the area observes daylight saving time, and you would have to evaluate the date and time to see if DST applies at the time.


    Author Comment

    true.  Do you know how that could be done in excel?
    LVL 37

    Accepted Solution

    What about the area codes that span multiple time zones (there are several). Here's a table that may be useful if you don't have the data already.

    Also, you run another problem that is getting increasingly worse.
    RingCentral, FaxZero, etc don't require that your number's area code actually match your location in any way. Also, if you did this for phones too, you can keep the same phone number even when moving/switching providers. So the area code and time zone are slowly becoming less and less correlated.

    Depending on what you are doing this for, you may need a web service that has more accurate information and can actually map the whole number (not just the area code) to an address. This will likely be a paid service.
    If you are just trying to automate the table I sent and don't care if you miss one or two (and more in the years to come), then you could easily make an Excel table that does all of the above (and just guesses for the ones that span).

    Author Comment


    Those are all good points.  I may need to change the plan and figure out the local time once the fax is processed and a zip code is available.

    Zip codes seem to be more stable in determining the time zone.

    Thank you,
    LVL 37

    Assisted Solution

    Yes, that should be more accurate. In that case, you might try starting with this database and see how it goes
    Note: Since it's CSV format, the zip codes like 00210 will just appear as 210 so you'll have to either convert them to fixed length strings in the table or store zip codes as numbers in your code.

    Author Closing Comment

    Thank you Tommy - I will be using something very similar to the zip code database.

    Thank you all for your input.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
    This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
    The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
    The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now