وظيفة date_sunset() في PHP
مثال
تقديم وقت الغروب اليومي في لشبونة، البرتغال:
<?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)); ?>
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 date and time timestamp to calculate the sunset time. |
format |
Optional. Specifies how to return the result:
|
latitude | Optional. Specifies the latitude of the location. Defaults to North Latitude. To specify South Latitude, please pass a negative value. |
longitude | Optional. Specifies the longitude of the location. Defaults to East Longitude. To specify West Longitude, please 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 timezone errors when it occurs. |