How to date sunrise in PHP

This article describe about date_sunrise() Function in PHP.
  • 2192

date_sunrise() Function

This function return the time of sunrise of a specified day and location.


date_sunrise(timestamp, format, latitude, longitude, zenith, gmt_offset)


Parameter Description
timestamp Required.
format Optional. Define how return the result.
  • SUNFUNCS_RET_STRING (returns the result as string. e.g. 18:26)
  • SUNFUNCS_RET_DOUBLE (returns the result as float. e.g. 18.78243437)
  • SUNFUNCS_RET_TIMESTAMP (returns the result as integer (timestamp). e.g. 4532689710)
latitude Optional. Defines the latitude of the location. The latitude defaults to North. If you want to define a South value, you have to pass a negative value.
longitude Optional. Defines the longitude of the location. The longitude defaults to East. If you want to Define a West value, you have to pass a negative value.
zenith Optional.
gmt_offset Optional. It define the difference between GMT and location in hour.


echo("Date: " . date("D M d Y") . "<br />");
echo("Sunrise time: ");




You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.