وظيفة date_sunrise() في 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_sunrise() function returns the sunrise time of the specified date and location.
Tip:See Also date_sunset() Function, returns the sunset time of the 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:
|
latitude | Optional. Specifies the latitude of the location. The default is North latitude. To specify South latitude, please pass a negative value. |
longitude | Optional. Specifies the longitude of the location. The default is East longitude. To specify West longitude, please pass a negative value. |
zenith | Optional. Default is date.sunrise_zenith. |
gmtoffset | Optional. Specifies the difference between GMT and local time in hours. |
Technical Details
Return Value: | If successful, it returns the sunrise time in the specified format. If it fails, it returns FALSE. |
---|---|
PHP Version: | 5+ |
Update Log: | Starting from PHP 5.1.0, the function reports E_STRICT and E_NOTICE time zone errors when it occurs. |