PHP date_isodate_set()ฟังก์ชัน
ตัวอย่าง
ตั้งวันที่ ISO เป็นสัปดาห์ที่ 5 ในปี 2013:
<?php
$date=date_create();
date_isodate_set($date,2013,5);
echo date_format($date,"Y-m-d");
?>
ความหมายและการใช้งาน
ฟังก์ชัน date_isodate_set() กำหนดวันที่ตามมาตรฐาน ISO 8601 โดยใช้การชดเชยสัปดาห์และวัน (แทนที่จะใช้วันที่ที่ระบุ)
ไวยากรณ์
date_isodate_set(object, year, week, day)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
object | Required. Specifies a DateTime object returned by date_create() |
year | Required. Specifies the year of the date |
week | Required. Specifies the week of the date |
day | Optional. Specifies the offset from the first day of the week. Default is 1 |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ส่งกลับวัตถุ DateTime เมื่อสำเร็จ FALSE เมื่อล้มเหลว |
---|---|
รุ่น PHP: | 5.2+ |
บันทึกการเปลี่ยนแปลง PHP: | PHP 5.3: เปลี่ยนค่าส่งคืนจาก NULL เป็น DateTime |
❮ PHP วันที่/เวลาอ้างอิง