PHP date_sunrise() ফাংশন

প্রয়োগ

চীনের শাংহাইয়ের আজকের সূর্যোদয়ের সময় ফিরিয়ে দিতে

<?php
// শাংহাই, চীন:
// অক্ষ: উত্তর অক্ষত্ব 31.22, দক্ষিণ অক্ষত্ব: 121.47
// ভূমিকম্প ≈ 90, অফসেট: +8 GMT
echo("শাংহাই, চীন: তারিখ: " . date("D M d Y"));
echo("<br>সূর্যোদয়ের সময়:");
echo(date_sunrise(time(),SUNFUNCS_RET_STRING,31.22,121.47,90,8));
?>

Run Example

Definition and Usage

The date_sunrise() function returns the sunrise time for a specified date and location.

Tip:See also date_sunset() Function, returns the sunset time for a specified date and location.

Syntax

date_sunrise(timestamp,format,latitude,longitude,zenith,gmtoffset);
Parameters Description
timestamp Required. Specifies the timestamp of the date and time to calculate the sunrise time.
format

Optional. Specifies how to return the result:

  • SUNFUNCS_RET_STRING (Returns the result as a string, like 16:46) (default)
  • SUNFUNCS_RET_DOUBLE (Returns the result as a floating-point number, like 16.78243132)
  • SUNFUNCS_RET_TIMESTAMP (Returns the result as an integer (timestamp), like 1095034606)
latitude Optional. Specifies the latitude of the location. Defaults to north latitude. To specify south latitude, pass a negative value.
longitude Optional. Specifies the longitude of the location. Defaults to east longitude. To specify west longitude, pass a negative value.
zenith Optional. Defaults to date.sunrise_zenith.
gmtoffset Optional. Specifies the difference between GMT and local time in hours.

Technical Details

Return Value: If successful, returns the sunrise time in the specified format. If failed, returns FALSE.
PHP Version: 5+
Update Log: Starting from PHP 5.1.0, this function reports E_STRICT and E_NOTICE time zone errors.