如果我传递纬度和经度,作为响应,我需要 GMT 时区值。
例如:
- 纬度:21.7679
- 经度:78.8718
- 响应除外:GMT+05:30
我不想使用任何网络服务。
最佳答案
如果您不想使用网络服务,则需要相当多的信息才能获得精确的结果。然而,有一个技巧可以轻松给出近似结果:
Divide longitude by 15
... 理论上,每个时区的宽度为 15 度,相当于平太阳时一小时的差异。实际上,时区的形状会发生变化,以匹配国内和国际边界。格林威治子午线以东每15度,以西每15度,民用时间分别向前和向后改变一小时。需要将经度(以度为单位)除以 15 才能找到适当的时区(以小时为单位)。例如:
At 150 degrees west (or 150° W) longitude, the time should be 150 degrees divided by 15 degrees = 10 hours behind Coordinated Universal Time (UTC/GMT) (or UTC-10).
At 75 degrees east (or 75° E) longitude, the time would be 75 degrees divided by 15 degrees = 5 hours ahead of UTC/GMT (or UTC+5).
关于java - 输入 : latitude and longitude 的 GMT 偏移量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17988456/