DateTime::setISODate function sets the date according to ISO 8601 standard - using weeks and day offsets rather than specific dates. It returns the modified DateTime.
DateTime::setISODate function sets the date according to ISO 8601 standard - using weeks and day offsets rather than specific dates. It returns the modified DateTime.The ISO Date Format PHP or DateTime::setISODate function sets the date according to ISO 8601 standard - using weeks and day offsets rather than specific dates. It returns the modified DateTime.
Description of ISO Date Format in PHP
public DateTime DateTime::setISODate ( int $year, int $week [, int $day ] )
DateTime date_isodate_set ( DateTime $object, int $year, int $week [, int $day ] )
Parameters of date_isodate_setdate() in PHP
object - Procedural style only: A DateTime object returned by date_create()
year - Year of the date.
week - Week of the date.
day - Offset from the first day of the week.
Example: Finding the date from a week number and day offset
<?php
date_default_timezone_set('India/Kolkata');
$datetime = new DateTime();
// Offset from start of week 2 (7) = 5
$datetime->setISODate(2009, 2, 5); // Day 5 of week 2 of 2009 is the 9th of January.
// Offset from start of week 2 (7) = 10
$datetime->setISODate(2009, 2, 10); // Day 10 of week 2 of 2009 is the 14th of January.
?>