Home >>PHP Date Time Functions >PHP date_isolate_set() Function

PHP date_isolate_set() Function

PHP date_isolate_set() Function

PHP date_isodate_set() function is used to set the date according to the ISO 8601 standard using weeks and day offsets instead of using the given specific date and month.

Syntax:

date_isodate_set(object, year, week, day);

Parameter Values

Parameter Description
object This is a required parameter. This parameter defines a DateTime object returned by date_create().
year This is a required parameter. This parameter defines the year of the date.
week This is a required parameter. This parameter defines the week of the date.
day This is an optional parameter. This parameter defines the offset from the first day of the week.

Here is an example of date_isodate_set() function in PHP:

<html>
<body>
<?php
$date=date_create();
date_isodate_set($date,2020,52);
echo date_format($date,"d-M-Y");
?>
</body>
</html>

Output:
21-Dec-2020

Example 2:

<html>
<body>
<?php
$date=date_create();
date_isodate_set($date,2020,10);
echo date_format($date,"Y-m-d") . "<br>";
date_isodate_set($date,2019,7,4);
echo date_format($date,"Y-m-d");
?>
</body>
</html>
Output:
2020-03-02
2019-02-14

No Sidebar ads