2
我使用谷歌API獲取天氣,並在響應我也獲得當地時間,但它是遠離,而不是正確的時間。當地時間從免費的API
有沒有Google的時間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>
這不是當地時間。如果您看到時間爲「2011-06-12 22:30:00 +0000」,其中+0000代表GMT +00:00您可以通過添加偏移量將其轉換爲當地時間。 – Codevalley 2011-11-08 09:48:28
哪裏可以得到偏移量?它不在返回的xml中 – 2011-11-08 14:27:06