Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
免费API的本地时间_Api_Time - Fatal编程技术网

免费API的本地时间

免费API的本地时间,api,time,Api,Time,我使用GoogleAPI获取天气信息,并在响应中获取当地时间,但这太离谱了,而且不是正确的时间 是否有谷歌的时间api或其他免费软件? 这就是我现在使用的: http://www.google.com/ig/api?weather=hong kong <?xml version="1.0" ?> - <xml_api_reply version="1"> - <weather module_id="0" tab_id="0" mobile_row="0" m

我使用GoogleAPI获取天气信息,并在响应中获取当地时间,但这太离谱了,而且不是正确的时间

是否有谷歌的时间api或其他免费软件?

这就是我现在使用的:

http://www.google.com/ig/api?weather=hong kong

  <?xml version="1.0" ?> 
- <xml_api_reply version="1">
- <weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0">
- <forecast_information>
      <city data="hong kong" /> 
      <postal_code data="hong kong" /> 
      <latitude_e6 data="" /> 
      <longitude_e6 data="" /> 
      <forecast_date data="2011-06-12" /> 
      <current_date_time data="2011-06-12 22:30:00 +0000" /> 
      <unit_system data="US" /> 
  </forecast_information>
- <current_conditions>
      <condition data="Partly Cloudy" /> 
      <temp_f data="86" /> 
      <temp_c data="30" /> 
      <humidity data="Humidity: 70%" /> 
      <icon data="/ig/images/weather/partly_cloudy.gif" /> 
      <wind_condition data="Wind: S at 12 mph" /> 
  </current_conditions>
- <forecast_conditions>
      <day_of_week data="Sun" /> 
      <low data="81" /> 
      <high data="84" /> 
      <icon data="/ig/images/weather/chance_of_rain.gif" /> 
      <condition data="Chance of Rain" /> 
  </forecast_conditions>
- <forecast_conditions>
      <day_of_week data="Mon" /> 
      <low data="81" /> 
      <high data="84" /> 
      <icon data="/ig/images/weather/mostly_sunny.gif" /> 
      <condition data="Partly Sunny" /> 
  </forecast_conditions>
- <forecast_conditions>
      <day_of_week data="Tue" /> 
      <low data="81" /> 
      <high data="84" /> 
      <icon data="/ig/images/weather/chance_of_storm.gif" /> 
      <condition data="Chance of Storm" /> 
  </forecast_conditions>
- <forecast_conditions>
      <day_of_week data="Wed" /> 
      <low data="81" /> 
      <high data="84" /> 
      <icon data="/ig/images/weather/chance_of_storm.gif" /> 
      <condition data="Chance of Storm" /> 
  </forecast_conditions>
  </weather>
  </xml_api_reply>
http://www.google.com/ig/api?weather=hong 香港
- 
- 
- 
- 
- 
- 
- 
- 

这不是当前时间。它是该位置上次天气更新的日期和时间。您会注意到,随着时间的推移(以常量),返回的值保持不变

您不需要API来获取某人计算机的本地时间。你自己问问他们就行了

<script language='javascript' >
var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
document.write("<b>" + hours + ":" + minutes + " " + "</b>")
</script>

var currentTime=新日期()
var hours=currentTime.getHours()
var minutes=currentTime.getMinutes()
文件。写(“+hours+”:“+minutes+”+”)

或者,如果这是在服务器上,只需使用您的编程语言向服务器询问本地时间

现在不是当地时间。如果您看到的时间是“2011-06-12 22:30:00+0000”,其中+0000表示GMT+00:00,您可以通过添加偏移量将其转换为本地时间。我可以从哪里获取偏移量?我笑着说“你自己问问他们”,但不管怎样,这似乎是唯一的办法+1.