PHP | DateTimeImmutable setISODate() Function Last Updated : 11 Oct, 2019 Comments Improve Suggest changes Like Article Like Report The DateTimeImmutable::setISODate() function is an inbuilt function in PHP which is used to sets the ISO (International Organization for Standardization ) date into the created DateTimeImmutable object. This function sets the date according to the ISO 8601 standard, using weeks and day offsets rather than specific dates. Syntax: DateTimeImmutable DateTimeImmutable::setISODate( int year, int week, int day) ) Parameters: This function accepts three parameters as mentioned above and described below: year: This parameter holds the year value in integer format. week: This parameter holds the week value in integer format . day: This parameter holds the day value in integer format .. Return Values: This function returns a new date. Below programs illustrate the DateTimeImmutable::setISODate() function in PHP: Program 1: php <?php // PHP program to illustrate DateTimeImmutable::setISODate() // function // Creating a new DateTimeImmutable() object $datetimeImmutable = new DateTimeImmutable(); // Initialising year, week and day $Year = '2019'; $Week = '10'; $Day = '03'; // Calling the DateTimeImmutable::setISODate() function $a = $datetimeImmutable->setISODate($Year, $Week, $Day); // Getting a new set of date in the // format of 'Y-m-d' echo $a->format('Y-m-d'); ?> Output: 2019-03-06 Program 2: php <?php // PHP program to illustrate DateTimeImmutable::setISODate() // function // Creating a new DateTimeImmutable() object $datetimeImmutable = new DateTimeImmutable(); // Calling the setISODate() function // with parameters like years of 2019, // week of 9 and day of 3 $a = $datetimeImmutable->setISODate(2019, 9, 03); // Getting a new set of date in the // format of 'Y-m-d' echo $a->format('Y-m-d'); ?> Output: 2019-02-27 Reference: https://www.php.net/manual/en/datetimeimmutable.setisodate.php Comment More infoAdvertise with us Next Article PHP | DateTimeImmutable setISODate() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-date-time PHP-function Similar Reads PHP | DateTimeImmutable setDate() Function The DateTimeImmutable::setDate() function is an inbuilt function in PHP which is used to set a new date in the created DateTimeImmutable object. Syntax: DateTimeImmutable DateTimeImmutable::setDate( int $year, int $month, int $day ) Parameters: This function accepts three parameters as mentioned abo 2 min read PHP | DateTimeImmutable::setTimezone() Function The DateTimeImmutable::setTimezone() function is an inbuilt function in PHP which is used to set the time zone for the created DateTimeImmutable object. This function returns the DateTimeImmutable object or False on failure. Syntax: DateTimeImmutable::setTimezone ( TimeZone ) Parameters: This functi 1 min read PHP | DateTimeImmutable setTimestamp() Function The DateTimeImmutable::setTimestamp() function is an inbuilt function in PHP which is used to set the date and time based on an Unix timestamp. Syntax: DateTimeImmutable DateTimeImmutable::setTimestamp( int $unixtimestamp ) Parameters: This function accepts single parameter $unixtimestamp which is u 1 min read PHP | DateTimeImmutable::sub() Function The DateTimeImmutable::sub() function is an inbuilt function in PHP which is used to subtract a number of days, months, years, hours, minutes and seconds from a created DateTimeImmutable object. Syntax: DateTimeImmutable::sub( interval ) Parameters: This function accepts a parameter interval which i 2 min read PHP | DateTime setDate() Function The DateTime::setDate() function is an inbuilt function in PHP which is used to reset the current date of DateTime object with the given date-time object. Syntax: Object oriented style: DateTime DateTime::setDate( int $year, int $month, int $day ) Procedural style: DateTime date_date_set( DateTime $ 2 min read PHP | DateTimeImmutable add() Function The DateTimeImmutable::add() function is an inbuilt function in PHP which is used to add a number of days, months, years, hours, minutes and seconds to a created DateTimeImmutable object. Syntax: DateTimeImmutable DateTimeImmutable::add( DateInterval $interval ) Parameters: This function accepts a s 2 min read PHP | DateTimeImmutable modify() Function The DateTimeImmutable::modify() function is an inbuilt function in PHP which is used to modify or alter the timestamp of the created DateTimeImmutable object. Syntax: DateTimeImmutable DateTimeImmutable::modify( string $modify ) Parameters: This function uses two parameters as mentioned above and de 2 min read PHP | DateTime sub() Function The DateTime::sub() function is an inbuilt function in PHP which is used to subtract a number of days, months, years, hours, minutes and seconds from a created DateTime object. Syntax: Object oriented style: DateTime DateTime::sub( DateInterval interval ) Procedural style: DateTime date_sub( DateTim 2 min read PHP | date_time_set() Function The date_time_set() function is an inbuilt function in PHP which is used to sets the time. This function resets the current time of the DateTime object to a different time. Syntax: Procedural style: date_time_set( $object, $hour, $minute, $second, $microseconds ) Object oriented style: DateTime::set 2 min read PHP | date_date_set() Function The date_date_set() function is an inbuilt function in PHP which is used to set a new Date. This function has four parameters $object, $year, $month and $day and returns DateTime object on success or false on failure. The date_date_set() function is an alias of DateTime::setDate() function. Syntax: 2 min read Like