Hàm date_isodate_set () trong PHP
Thí dụ
Đặt ngày ISO thành tuần thứ 5 trong năm 2013:
<?php
$date=date_create();
date_isodate_set($date,2013,5);
echo date_format($date,"Y-m-d");
?>
Định nghĩa và Cách sử dụng
Hàm date_isodate_set () đặt ngày theo tiêu chuẩn ISO 8601, sử dụng các tuần và ngày chênh lệch (thay vì sử dụng một ngày cụ thể).
Cú pháp
date_isodate_set(object, year, week, day)
Giá trị tham số
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 |
Chi tiết kỹ thuật
Giá trị trả lại: | Trả về một đối tượng DateTime khi thành công. FALSE khi thất bại |
---|---|
Phiên bản PHP: | 5,2+ |
PHP Changelog: | PHP 5.3: Đã thay đổi giá trị trả về từ NULL thành DateTime |
❮ Tham chiếu ngày / giờ PHP