使用电话号码获取当前时间 [英] Get current time with a phone number

查看:80
本文介绍了使用电话号码获取当前时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个RoR移动应用程序,该应用程序可以为我提供给定电话号码在该国的当前时间以及其区号.是否有一个好的api?

I want to write an RoR mobile app which gives me the current time at the country for a given phone number, with its area code. Is there a good api for this?

推荐答案

不是个好主意.

对于具有多个不同时区和多个区号的国家,您将怎么做?时区与区号不一定是一对一的映射.

What will you do for countries that have several different time zones and many area codes? There isn't necessarily a one-to-one mapping of time zone to area code.

例如,在美国,928区号覆盖了亚利桑那州的大部分地区,包括两个不同的时区,因为在该州的东北部,纳瓦霍族采用夏令时,而亚利桑那州的其他地区则不采用夏令时.因此,在一年的一部分时间内,928区号的两个不同部分之间相差一小时.

For example, in the USA, the 928 area code covers much of Arizona, including two different time zones because in the north-eastern portion of the state, the Navajo nation honors daylight savings time while the rest of Arizona does not. So for part of the year there is a one hour difference between two different parts of the 928 area code.

一个更干净的示例-605区号覆盖了南达科他州的整个州.该州的西半部使用山区时间,该州的东半部使用中央时间.

A cleaner example - the 605 area code covers the entire state of South Dakota. The western half of the state uses Mountain Time, and the eastern half of the state uses Central Time.

我敢肯定,在美国以外,还有更多的例子.

I'm sure outside of the USA there are plenty of more examples.

此外,人们使用手机旅行.我知道我的头顶上有3个人,在转移到新的电话号码后,他们用不同的区号保留了电话号码.

Also, people travel with their mobile phones. I know 3 people of the top of my head that kept their phone number with a different area code after moving to a new one.

此外,移动电话号码可移植性

Also, Mobile Number Portability and Local Number Portability allow for people to move into other areas and keep their phone numbers - including area code. Thus area code only will tell you where the number first originated, not where it currently is.

这篇关于使用电话号码获取当前时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆