PHP date_sunset() ফাংশন

প্রয়োগ

প端তুগাল পর্তুগালের আজকের সূর্যাস্তের সময় ফিরিয়ে দিন:

<?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_sunset() function returns the sunset time for the specified date and location.

Tip:See also date_sunrise() Function, returns the sunrise time for the specified date and location.

Syntax

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

Optional. Specifies how to return the result:

  • SUNFUNCS_RET_STRING (returns the result as a string, for example, 16:46) (default)
  • SUNFUNCS_RET_DOUBLE (returns the result as a floating-point number, for example, 16.78243132)
  • SUNFUNCS_RET_TIMESTAMP (returns the result as an integer (timestamp), for example, 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.sunset_zenith.
gmtoffset Optional. Specifies the difference between GMT and local time in hours.

Technical Details

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