date_isodate_set ($date_obj,$year, $week,$day);
Parameter | DESCRIPTION |
---|---|
$date_obj | Required : Input date object to be assigned new value. |
$year | Required: Year in 4 digit. |
$week | Required: week of the year , starting from 1st week as 1 |
$day | Optional: default value is 1 , offset from 1st day of the week |
$date = new DateTime();
$date->setISODate(2019, 2);
echo $date->format('Y-m-d'); // Output is 2019-01-07
3rd day of 5th week of year 2019
$date = new DateTime();
$date->setISODate(2019, 5,3);
echo $date->format('Y-m-d'); // Output is 2019-01-30
$date = new DateTime();
$date->setISODate(2019, 4,11);
echo $date->format('Y-m-d'); // Output is 2019-01-31
$date = date_create();
date_isodate_set($date, 2019, 25);
echo date_format($date, 'Y-m-d'); // Output is 2019-06-17
With $day value ( Optional )
$date = date_create();
date_isodate_set($date, 2019, 25,5);
echo date_format($date, 'Y-m-d'); // Output is 2019-06-21
PHP Date FunctionssetDate() : Set date for date object
Timestamp in PHP Displaying calendar for selection of date by user
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.