从纬度经度到GMT的时间偏移的粗略估算 [英] rough estimate of the time offset from GMT from latitude longitude

查看:86
本文介绍了从纬度经度到GMT的时间偏移的粗略估算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以从纬度/经度估算距格林尼治标准时间(或时区)的偏移量?我见过地名,但是这需要长期工作,我们真的不希望依赖Web服务.它只是用于确定在向各种用户提供信息时是显示今天"还是今晚",因此它不需要太准确(一两个小时的时间就不错了).

Is there a way to estimate the offset from GMT (or time zone) from a latitude/longitude? I've seen geonames, but this would need to work long term and we don't really want to rely on a web service. It'd just be used for determining whether to display "today" or "tonight" when giving information to various users so it wouldn't need to be too accurate (an hour or two off wouldn't be bad).

推荐答案

offset = direction * longitude * 24 / 360

其中方向为东1,西为-1,经度为(-180,180)

where direction is 1 for east, -1 for west, and longitude is in (-180,180)

这篇关于从纬度经度到GMT的时间偏移的粗略估算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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