date_sun_info Returns an array with information about sunset/sunrise and twilight begin/end php函数


date_sun_info

(PHP 5 >= 5.1.2)

date_sun_infoReturns an array with information about sunset/sunrise and twilight begin/end

说明

array date_sun_info ( int $time , float $latitude , float $longitude )

参数

time

Timestamp.

latitude

Latitude in degrees.

longitude

Longitude in degrees.

返回值

Returns array on success 或者在失败时返回 FALSE.

范例

Example #1 A date_sun_info() example

<?php
$sun_info 
date_sun_info(strtotime("2006-12-12"), 31.766735.2333);
foreach (
$sun_info as $key => $val) {
    echo 
"$key: " date("H:i:s"$val) . " ";
}
?>

以上例程会输出:

sunrise: 05:52:11
sunset: 15:41:21
transit: 10:46:46
civil_twilight_begin: 05:24:08
civil_twilight_end: 16:09:24
nautical_twilight_begin: 04:52:25
nautical_twilight_end: 16:41:06
astronomical_twilight_begin: 04:21:32
astronomical_twilight_end: 17:12:00

参见


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3