In this article, you will learn how you can set a date in ISO format. The date_isodate_set() function sets a date in IO (8601) standard. It uses weeks and days instead of using the Date/Time.
What is the syntax of the date_isodate_set() function in PHP?
date_isodate_set(object, year, week, day)
Parameters | Details |
---|---|
object | DateTime Object – Required |
year | Specify the year – Required |
week | Specify the Week – Required |
day | Specify the day – Required |
Example of the date_isodate_set() function
Example 1. In the example below, we create a date and then set it in iso standard format.
<?php
$d=date_create();
date_isodate_set($d,2021,7);
echo date_format($d,"Y-m-d");
?>