Set the ISO date to the 5th week of 2013.
| <?php $date=date_create(); date_isodate_set($date,2013,5); echo date_format($date,“Y-m-d”); ?> |
The date_isodate_set() function sets a date according to the ISO 8601 standard, using week numbers and day offsets rather than a specific calendar date.
| date_isodate_set(object, year, week, day) |
|
Parameter |
Description |
|
object |
Required. Specifies a DateTime object created by |
|
year |
Required. Specifies the year of the date. |
|
week |
Required. Specifies the week of the year for the date. |
|
day |
Optional. Specifies the offset from the first day of the week; the default is 1. |
|
Return Value: |
Returns a DateTime object on success; FALSE on failure. |
|
PHP Version: |
5.2+ |
|
PHP Changelog: |
In PHP 5.3, the return value was changed from NULL to DateTime. |