Web 服务 - 一个城市的当前时区? [英] Web service - current time zone for a city?

查看:21
本文介绍了Web 服务 - 一个城市的当前时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有某种网络服务(或任何其他方式)来提取(美国)城市的当前时区设置.对于该国不遵循夏令时并且基本上在其他人都在切换夏季/冬季时间时跳跃时区的部分地区......我不喜欢创建自己的不遵循 DST 的地方的数据库.有没有办法按需提取这些数据?

Is there a web service of some sort (or any other way) to pull a current time zone settings for a (US) city. For the parts of the country that don't follow the Daylight Saving Time and basically jump timezones when everyone else is switching summer/winter time... I don't fancy creating own database of the places that don't follow DST. Is there a way to pull this data on demand?

我需要这个用于数据库服务器(而不是客户端工作站)——数据库中存储的实体具有 City、State 作为属性.我需要随时知道这些实体的当前时区.

I need this for the database server (not for client workstations) - there entities stored in the database that have City, State as properties. I need know current timezone for these entities at any moment of time.

推荐答案

earthtools.org 提供了一个免费的网络服务来从这里获取一个城市的时区:

earthtools.org provides a free web service to get the time zone from a city here:

http://www.earthtools.org/webservices.htm#timezone

您只需像这样传入 long/lat 值:(这是针对纽约的)

You just pass in the long/lat values like this: (This is for New York)

http://www.earthtools.org/timezone-1.1/40.71417/-74.00639

好像earthtools 已被关闭.Google Time Zone API 是一个不错的选择(在 2008 年回答这个问题时不存在).要使用它,您必须首先激活时区 API在您的帐户上.如果您保持在以下限制以下,则免费:

It seems like earthtools has been shut down. A good alternative (That did not exist in 2008 when this question was answered) is the Google Time Zone API. To use it you must first activate the Time Zone API on your account. It is free if you stay below these limits:

  • 每 24 小时 2500 个请求.
  • 每秒 5 个请求.

文档可在 Google Developers 上找到.

The documentation is available on Google Developers.

这篇关于Web 服务 - 一个城市的当前时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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