PHP date_isodate_set() Function

Example

Set the ISO date for the 5th week of 2016:

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

Running Instance

Definition and Usage

The date_isodate_set() function sets the date according to the ISO 8601 standard, using the offset of the week and day (instead of using a specific date).

Syntax

date_isodate_set(object,year,week,day);
Parameter Description
object Required. Specifies by date_create() The returned DateTime object.
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. The default is 1.

Technical Details

Return Value: Returns a DateTime object on success, and FALSE on failure.
PHP Version: 5.2+
Update Log: PHP 5.3.0: The return value changed from NULL to DateTime.