PHP date_time_set()ฟังก์ชัน
ตัวอย่าง
ตั้งเวลา:
<?php
$date=date_create("2013-05-01");
date_time_set($date,13,24);
echo date_format($date,"Y-m-d H:i:s");
?>
ความหมายและการใช้งาน
ฟังก์ชัน date_time_set() ตั้งเวลา
ไวยากรณ์
date_time_set(object, hour, minute, second, microseconds)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
object | Required. Specifies a DateTime object returned by date_create() |
hour | Required. Specifies the hour of the time |
minute | Required. Specifies the minute of the time |
second | Optional. Specifies the second of the time. Default is 0 |
microseconds | Optional. Specifies the microsecond of the time. Default is 0 |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ส่งกลับวัตถุ DateTime เมื่อสำเร็จ FALSE เมื่อล้มเหลว |
---|---|
รุ่น PHP: | 5.2+ |
บันทึกการเปลี่ยนแปลง PHP: | PHP 7.1: เพิ่มพารามิเตอร์microseconds PHP 5.3: เปลี่ยนค่าส่งคืนจาก NULL เป็น DateTime |
❮ PHP วันที่/เวลาอ้างอิง