java - 输入 : latitude and longitude 的 GMT 偏移量

标签 java

如果我传递纬度和经度,作为响应,我需要 GMT 时区值。

例如:

  • 纬度:21.7679
  • 经度:78.8718
  • 响应除外:GMT+05:30

我不想使用任何网络服务。

最佳答案

如果您不想使用网络服务,则需要相当多的信息才能获得精确的结果。然而,有一个技巧可以轻松给出近似结果:

Divide longitude by 15

根据www.timeanddate.com :

... 理论上,每个时区的宽度为 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/

相关文章:

java - 为什么与 jclouds 一起使用的 CloudWatch API getMetricStatisticsInRegion 会抛出 UndeclaredThrowableException?

java - 是否有带有自定义比较器的 retainAll() 的实现?

java - 使用正则表达式一次性替换主题标签

java - 使用kafka流根据消息 key 向主题发送消息

javascript - 使用模拟器时 react native firebase 崩溃

java - 如何避免代码库中存在 keystore/trustore 纯文本密码?

java - 如何在android中将所有位图图像发送到sdcard

java - @Value boolean 返回值 true 的 'invalid boolean value'

java - 为什么zuul网关应用程序需要这么长时间才能以优雅的方式关闭

java - 在 spring 托管 bean 的构造函数中初始化 Jersey 客户端