PHP date_sun_info()関数
例
緯度31.7667、経度35.2333の場合、2013年1月1日に日没/日の出と薄明の開始/終了に関する情報を返します。
<?php
$sun_info=date_sun_info(strtotime("2013-01-01"),31.7667,35.2333);
foreach ($sun_info as $key=>$val)
{
echo "$key: " . date("H:i:s",$val) . "<br>";
}
?>
定義と使用法
date_sun_info()関数は、指定された曜日と場所について、日没/日の出と薄明の開始/終了に関する情報を含む配列を返します。
ヒント:date_sunrise()関数を見て、指定した曜日と場所の日の出時刻を返します。
ヒント: date_sunset()関数を見て、指定した曜日と場所の日の入り時刻を返します。
構文
date_sun_info(timestamp, latitude, longitude)
パラメータ値
Parameter | Description |
---|---|
timestamp | Required. Specifies a timestamp |
latitude | Required. Specifies the latitude in degrees |
longitude | Required. Specifies the longitude in degrees |
技術的な詳細
戻り値: | 成功すると配列を返します。失敗するとFALSE |
---|---|
PHPバージョン: | 5.1.2 + |
❮PHPの日付/時刻リファレンス