PHP date_sunrise()ฟังก์ชัน
ตัวอย่าง
ย้อนเวลาพระอาทิตย์ขึ้นที่เมืองลิสบอน ประเทศโปรตุเกส วันนี้:
<?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>Sunrise time: ");
echo(date_sunrise(time(),SUNFUNCS_RET_STRING,38.4,-9,90,1));
?>
ความหมายและการใช้งาน
ฟังก์ชัน date_sunrise() ส่งกลับเวลาพระอาทิตย์ขึ้นสำหรับวันและตำแหน่งที่ระบุ
เคล็ดลับ:ดูฟังก์ชัน date_sunset()เพื่อคืนค่าเวลาพระอาทิตย์ตกสำหรับวันและตำแหน่งที่ระบุ
ไวยากรณ์
date_sunrise(timestamp, format, latitude, longitude, zenith, gmtoffset)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
timestamp | Required. Specifies the timestamp of the day from which the sunrise 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.sunrise_zenith |
gmtoffset | Optional. Specifies the difference between GMT and local time in hours |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ส่งกลับเวลาพระอาทิตย์ขึ้นในรูปแบบ ที่ระบุ เมื่อสำเร็จ FALSE เมื่อล้มเหลว |
---|---|
รุ่น PHP: | 5+ |
บันทึกการเปลี่ยนแปลง PHP: | PHP 5.1: ฟังก์ชันนี้ออกข้อผิดพลาดโซนเวลา E_STRICT และ E_NOTICE แล้ว |
❮ PHP วันที่/เวลาอ้างอิง