设置 2016 年第 5 周的 ISO 日期:
<?php
$date=date_create();
date_isodate_set($date,2016,5)
;
echo date_format($date,"Y-m-d");
?>
定义和用法
date_isodate_set() 函数根据 ISO 8601 标准设置日期,使用周和天的偏移量(而不是使用一个具体的日期)。
语法
date_isodate_set(object,year,week,day);
参数 | 描述 |
---|---|
object | 必需。规定由 date_create() 返回的 DateTime 对象。 |
year | 必需。规定日期中的年。 |
week | 必需。规定日期中的周。 |
day | 可选。规定离一周中第一天的偏移量。默认为 1。 |