Hàm date_isodate_set() trong PHP
Ví dụ
Đặt ngày ISO thành tuần thứ 5 năm 2013:
<?php
$date=date_create();
date_isodate_set($date,2013,5);
echo date_format($date,"Y-m-d");
?>
Hãy tự mình thử »Đị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 độ lệch tuần và ngày (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ả về: | Trả về đối tượng DateTime nếu thành công. FALSE khi thất bại |
---|---|
Phiên bản PHP: | 5.2+ |
Nhật ký thay đổi PHP: | PHP 5.3: Đã thay đổi giá trị trả về từ NULL thành DateTime |
❮ Tham chiếu ngày/giờ PHP