Sunset and Sunrise Time using PHP
Here are these functions:-
date_sunrise
date_sunrise — Returns time of sunrise for a given day and location.
date_sunset
date_sunset — Returns time of sunset for a given day and location.
Uses
echo date_sunrise(time(), SUNFUNCS_RET_STRING, 29.91999999999999, 73.880, 90, 5.5);
echo date_sunset(time(), SUNFUNCS_RET_STRING, 29.91999999999999, 73.880, 90, 5.5);
You must know the latitude and longitude of the place, to use these functions.Here in above example, 29.91999999999999 is latitude, 73.880 is longitude, 90 is Zenith, and 5.5 is gmtoffset.
So the format should be like this:-
echo date_sunrise(time(), format, latitude, longitude, zenith, gmtoffset);
echo date_sunset(time(), format, latitude, longitude, zenith, gmtoffset);
Labels: php, resource, Tutorials
Help Me Write. What shall I write next?By : Motyar+ @motyar
Post a Comment