PHP date_timezone_set()ฟังก์ชัน
ตัวอย่าง
ตั้งค่าเขตเวลาสำหรับวัตถุ DateTime:
<?php
$date=date_create("2013-05-25",timezone_open("Indian/Kerguelen"));
echo date_format($date,"Y-m-d H:i:sP");
?>
ความหมายและการใช้งาน
ฟังก์ชัน date_timezone_set() ตั้งค่าโซนเวลาสำหรับออบเจกต์ DateTime
ไวยากรณ์
date_timezone_set(object, timezone)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
object | Required. Specifies a DateTime object returned by date_create(). This function modifies this object |
timezone | Required. Specifies a DateTimeZone object that represents the desired time zone. Tip: Look at a list of all supported timezones in PHP |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ส่งกลับวัตถุ DateTime สำหรับการผูกมัดเมธอด FALSE เมื่อล้มเหลว |
---|---|
รุ่น PHP: | 5.2+ |
บันทึกการเปลี่ยนแปลง: | PHP 5.3: เปลี่ยนค่าส่งคืนจาก NULL เป็น DateTime (เมื่อสำเร็จ) |
❮ PHP วันที่/เวลาอ้างอิง