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

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

问题描述

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

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 已被关闭.一个很好的替代方案(在 2008 年回答这个问题时不存在)是 Google Time Zone API.要使用它,您必须先激活时区 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天全站免登陆