Google weather API shows temperature in Fahrenheit.
After watching this post, I was able to convert temperature from F to C.
However, it shows like 17.222222222222° C - 28.888888888889° C, Clear
. How can i make it only 17° C-28° C
.
Thanks in advance.
function toCelsius($deg)
{
return floor(($deg-32)/1.8);
}
You can use floor to return the next lowest integer value by rounding down value if necessary.