downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

date_sunrise> <date_sub
Last updated: Fri, 27 Nov 2009

view this page in

date_sun_info

(PHP 5 >= 5.1.2)

date_sun_infoGüneşin doğuşu/batışı ve alacakaranlık başlangıcı/sonu hakkında bilgi içeren bir dizi döndürür

Açıklama

array date_sun_info ( int $zaman , float $enlem , float $boylam )

Değiştirgeler

zaman

Zaman damgası.

enlem

Enlem derecesi.

boylam

Boylam derecesi.

Dönen Değerler

Başarılı olduğunda diziyi, başarısız olduğunda FALSE değerini döndürür.

Örnekler

Örnek 1 - date_sun_info() örneği

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

Yukarıdaki örneğin çıktısı:

sunrise: 06:54:58
sunset: 16:36:54
transit: 11:45:56
civil_twilight_begin: 06:26:20
civil_twilight_end: 17:05:32
nautical_twilight_begin: 05:54:03
nautical_twilight_end: 17:37:49
astronomical_twilight_begin: 05:22:39
astronomical_twilight_end: 18:09:14

Ayrıca Bakınız

  • date_sunrise() - Belirtilen gün ve konum için şafak zamanını döndürür
  • date_sunset() - Verilen gün ve konum için günbatımı zamanını döndürür



add a note add a note User Contributed Notes
date_sun_info
glenbo (_AT_) mac (_DOT_) com
17-Jun-2008 07:54
It should be noted that for extreme geographical locations date_sun_info() might return unexpected values. Values of 1 or empty may be returned. If you are expecting a unix timestamp this will default to the epoch, or epoch+1, which is not what you would expect.

After researching official almanac records for these locations it appears likely that for sunrise and sunset return values of 1 relate to a situation where the sun is above the horizon for the entire 24 hour day. It is also possible that empty return values relate to a situation where the sun is below the horizon for the entire 24 hour day. In the case of twilight data a 1 probably means that the sun never dips below that zenith, and an empty value means the sun never rises above said zenith for that given day.

The following code exhibits unique dates from the northernmost city Ny-Ålesund, Svalbard, and the southernmost city McMurdo Research Station, Antarctica.

<?php

$northernmost_city_latitude
= 78.92;   // Ny-Ålesund, Svalbard
$northernmost_city_longitude = 11.93;
$southernmost_city_latitude = -77.88// McMurdo Research Station, Antarctica
$southernmost_city_longitude = 166.73;

print_r( date_sun_info( strtotime("2008-01-01") , $northernmost_city_latitude, $northernmost_city_longitude) );
print_r( date_sun_info( strtotime("2008-04-01") , $northernmost_city_latitude, $northernmost_city_longitude) );
print_r( date_sun_info( strtotime("2008-01-01") , $southernmost_city_latitude, $southernmost_city_longitude) );
print_r( date_sun_info( strtotime("2008-06-01") , $southernmost_city_latitude, $southernmost_city_longitude) );

?>

This will return the following. Observe that sometimes a value of 1 or empty is returned.

Array
(
    [sunrise] =>
    [sunset] =>
    [transit] => 1199186158
    [civil_twilight_begin] =>
    [civil_twilight_end] =>
    [nautical_twilight_begin] => 1199184075
    [nautical_twilight_end] => 1199188241
    [astronomical_twilight_begin] => 1199170475
    [astronomical_twilight_end] => 1199201840
)
Array
(
    [sunrise] => 1207019232
    [sunset] => 1207077865
    [transit] => 1207048548
    [civil_twilight_begin] => 1
    [civil_twilight_end] => 1
    [nautical_twilight_begin] => 1
    [nautical_twilight_end] => 1
    [astronomical_twilight_begin] => 1
    [astronomical_twilight_end] => 1
)
Array
(
    [sunrise] => 1
    [sunset] => 1
    [transit] => 1199148994
    [civil_twilight_begin] => 1
    [civil_twilight_end] => 1
    [nautical_twilight_begin] => 1
    [nautical_twilight_end] => 1
    [astronomical_twilight_begin] => 1
    [astronomical_twilight_end] => 1
)
Array
(
    [sunrise] =>
    [sunset] =>
    [transit] => 1212281461
    [civil_twilight_begin] =>
    [civil_twilight_end] =>
    [nautical_twilight_begin] => 1212273312
    [nautical_twilight_end] => 1212289609
    [astronomical_twilight_begin] => 1212264187
    [astronomical_twilight_end] => 1212298734
)

date_sunrise> <date_sub
Last updated: Fri, 27 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites