基于位置的时区检索 [英] Location based Timezone Retrieval

查看:127
本文介绍了基于位置的时区检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于:LDAP存储用户的位置。

Given: LDAP stores location of users.

如何使用他们的位置驾驶他们的时区?任何指针都被接受,首选Java语言。

How do I drive their timezones using their location? Any pointers are accepted, Java language preferred.

提前致谢。

推荐答案

这取决于位置包含的信息?您需要将位置映射到时区名称,最好是Olson样式时区名称,因为它们更详细,更容易映射,因为它们本身就是位置。

This depends on information the "location" contains? You'd somehow need to map the location to a timezone name, preferably the Olson style timezone names, because they are more detailed and easier to map, as they are locations themselves.

如果它是一个近似地址(如国家和城市等),那么几个地理定位服务确实在其信息中包含时区,因此您可以调用这些服务并查看。

If it's an approximate addres (like country and city or so) then several geolocation services do include timezones in their information, so you can call these services and see.

如果它是具有纬度和经度的地理位置,那么名为Earthtools的站点可以为您提供时区。 http://www.earthtools.org/webservices.htm#timezone

If it's a geolocation with latitude and longitude then a site called Earthtools can give you the timezone. http://www.earthtools.org/webservices.htm#timezone

这个数据库提供从城市和国家到时区的映射: http://citytimezones.info/cms/pending_requests.htm

There is this database that provides mappings from cities and countries to timezones: http://citytimezones.info/cms/pending_requests.htm

不幸的是,它使用Windows时区名称,但你可以使用这个数据 http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml 从Unicode.org到Windows时区名称和Olson TZ名称之间的映射。

Unfortunately it uses Windows timezone names, but you can this data http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml from Unicode.org to map between Windows timezone names and the Olson TZ names.

这篇关于基于位置的时区检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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