Google Weather API温度转换

时间:2011-12-10 04:16:19

标签: php xml weather-api google-weather-api

Google weather API显示华氏温度。

在观看this post之后,我能够将温度从F转换为C.

但是,它显示为17.222222222222° C - 28.888888888889° C, Clear。我怎样才能使它17° C-28° C

提前致谢。

1 个答案:

答案 0 :(得分:7)

function toCelsius($deg)
{
  return floor(($deg-32)/1.8);
}

如果需要,您可以通过舍入值来使用floor返回下一个最小的整数值。

相关问题