Syntax
array date_sun_info ( int $time, float $latitude, float $longitude ); |
Definition and Usage
This function returns an array with information about sunset/sunrise and twilight begin/end.
Paramters
Parameter | Description |
---|---|
time | Required. Timestamp. |
latitude | Required. Latitude in degrees. |
longitude | Required. Longitude in degrees. |
Return Value
Returns array on success or FALSE on failure.
Example
Following is the usage of this function:
<?php $sun_info = date_sun_info(strtotime("2007-07-12"), 31.7667, 35.2333); foreach ($sun_info as $key => $val) { echo "$key: " . date("H:i:s", $val) . "\n"; } ?> |
This will produce following result:
sunset: 10:46:47 transit: 03:44:44 civil_twilight_begin: 20:15:05 civil_twilight_end: 11:14:23 nautical_twilight_begin: 19:41:27 nautical_twilight_end: 11:48:00 astronomical_twilight_begin: 19:05:25 astronomical_twilight_end: 12:24:02 |
No comments:
Post a Comment