Set the ISO date for week 5 of 2013:
<?php$date=date_create();date_isodate_set($date,2013,5);echo date_format($date,"Ymd");?>The date_isodate_set() function sets a date according to the ISO 8601 standard, using week and day offsets (rather than using a specified date).
date_isodate_set( object,year,week,day);
parameter | describe |
---|---|
object | Required. Specifies a DateTime object returned by date_create(). |
year | Required. The year in the specified date. |
week | Required. The week in the specified date. |
day | Optional. Specifies the offset from the first day of the week. Default is 1. |
Return value: | Returns a DateTime object if successful, or FALSE if failed. |
---|---|
PHP version: | 5.2+ |
Update log: | PHP 5.3.0: Return value changed from NULL to DateTime. |