Latest web development tutorials

PHP date_isodate_set () function

PHP Date / Time PHP Date / Time Reference Manual

Examples

Set up in 2013 the first five weeks of the ISO date:

<?php
$date=date_create();
date_isodate_set($date,2013,5);
echo date_format($date,"Y-m-d");
?>

Running instance »

Definition and Usage

date_isodate_set () function to set the date, use the week and offset days (instead of using a predetermined date) according to the ISO 8601 standard.

grammar

date_isodate_set( object,year,week,day);

参数 描述
object 必需。规定一个由 date_create() 返回的 DateTime 对象。
year 必需。规定日期中的年。
week 必需。规定日期中的周。
day 可选。规定离一周中第一天的偏移量。默认为 1。

technical details

return value: If successful, it returns a DateTime object, if it fails to return FALSE.
PHP version: 5.2+
Update log: PHP 5.3.0: the return value from NULL to DateTime.


PHP Date / Time PHP Date / Time Reference Manual