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 Functions
setDate() : Set date for date object
Timestamp in PHP Displaying calendar for selection of date by user
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.