开发者

Determine phone number based on time zone?

I have a (potentially international) phone number. It may or may not have a country code prefix. Does anyone know of a database that will help me map phone number => time zone? I would even just like to map phone number => country, since I can probably create country => time zone by scraping existing data on the web. This is a more complicated problem than it looks; for example, how do I know if it's a US-based n开发者_C百科umber -- e.g. is it a USA area code, or an international country calling code?

Any language is fine; I can port it.


The best library I know of for parsing phone numbers in arbitrary formats is libphonenumber.

You can't map countries to time zones for what should be obvious reasons. Both you and someone in California are in the same country, you're not even in close to the same time zones. Other countries are even wider.


No. Your primary problem here lwill be that lots of countries share each timezone. Eg UK and Ireland, France, Germany, ITaly etc.

You may be able to guess based on number structure, but your best bet I'm afraid is to try to get the code in any new data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜