I want to use date_sunset and date_sunrise php's functions but the result is not accurate .. I have the user's IP, Longitude, Latitude and i googled how to calculate Zenith value but found nothing.
And the final value in those functions is GMT Offset that i couldn't get it also.
This is available values that i can get for any client and want to use it to get Zenith and GMT Offset ..
geoiprecord Object (
[country_code] => EG
[country_code3] => EGY
[country_name] => Egypt
[region] => C
[city] => Cairo
[postal_code] =>
[latitude] => 30.0771
[longitude] => 31.2859
[area_code] =>
[dma_code] =>
[metro_code] =>
[continent_code] => AF
[region_name] => Cairo Governorate
[timezone] => Africa/Cairo
)
Just leave the
$zenith
and$gmt_offset
parameters at their defaults. The result of these functions is an integer timestamp which is in terms of UTC. Simply convert the result to the time zone you have in your data"Africa/Cairo"
.See this answer for a good example of how to convert timestamp to a specific time zone in PHP.