PHP date_isodate_set() function

P
PHP date_interval_format() function
PHP date_modify() function

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)
ParametersDetails
objectDateTime Object – Required
yearSpecify the year – Required
weekSpecify the Week – Required
daySpecify the day – Required
PHP date_isodate_set() method

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");
?>
PHP date_interval_format() function
PHP date_modify() function

Add comment

Tutor Network

Share this

Learn PHP from A to Z