PHP date_sunset() 함수
예시
오늘 포르투갈 리스본의 일몰 시간을 반환합니다.
<?php
// Lisbon, Portugal:
// Latitude: 38.4 North, Longitude: 9 West
// Zenith ~= 90, offset: +1 GMT
echo("Lisbon, Portugal: Date: " . date("D M d Y"));
echo("<br>Sunset time: ");
echo(date_sunset(time(),SUNFUNCS_RET_STRING,38.4,-9,90,1));
?>
정의 및 사용
date_sunset() 함수는 지정된 날짜와 위치의 일몰 시간을 반환합니다.
팁: date_sunrise() 함수를 살펴보고 지정된 날짜와 위치의 일출 시간을 반환합니다.
통사론
date_sunset(timestamp, format, latitude, longitude, zenith, gmtoffset)
매개변수 값
Parameter | Description |
---|---|
timestamp | Required. Specifies the timestamp of the day from which the sunset time is taken |
format |
Optional. Specifies how to return the result:
|
latitude | Optional. Specifies the latitude of the location. Defaults to North. To specify a value for South, pass in a negative value |
longitude | Optional. Specifies the longitude of the location. Defaults to East. To specify a value for West, pass in a negative value |
zenith | Optional. Defaults to date.sunset_zenith |
gmtoffset | Optional. Specifies the difference between GMT and local time in hours |
기술적 세부 사항
반환 값: | 성공 시 지정된 형식으로 일몰 시간을 반환합니다. 실패시 FALSE |
---|---|
PHP 버전: | 5+ |
변경 로그: | PHP 5.1.0부터 이 함수는 E_STRICT 및 E_NOTICE 시간대 오류를 생성합니다. |
❮ PHP 날짜/시간 참조