• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 471
  • Last Modified:

Convert Local time based on area code


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
4 Solutions
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: http://www.webservicex.net/uszip.asmx, 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.
MeowserMAuthor Commented:
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?

Patrick MatthewsCommented:

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.

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

MeowserMAuthor Commented:
true.  Do you know how that could be done in excel?
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).
MeowserMAuthor Commented:

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,
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.
MeowserMAuthor Commented:
Thank you Tommy - I will be using something very similar to the zip code database.

Thank you all for your input.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now