Change language

PHP DateTimeImmutable setISODate () function

Syntax:
DateTimeImmutable DateTimeImmutable::setISODate (int year, int week, int day))
Parameters:This function takes three parameters as above and described below:
  • year:this parameter contains an integer year value.
  • week:this parameter contains an integer week value.
  • day:this parameter contains the day value in integer format.
Return values:this function returns a new date. The programs below illustrate the DateTimeImmutable::setISODate()function in PHP:Program 1:
// PHP illustration program DateTimeImmutabl e::setISODate()
// function 
// Create a new DateTimeImmutable() object $datetimeImmutable = new DateTimeImmutable();  
// Initialize the year, week and day $Year = ’2019’ ; $Week = ’10’ ; $Day = ’03’ ;  
// Calling the DateTimeImmutable::setISODate() function $a = $datetimeImmutable -> setISODate ( $Year , $Week , $Day );  
// Get a new set of dates in // format ’ Ymd ’ echo $a -> format ( ’ Ymd’ ); ?>
Output:
2019-03-06
Program 2:
// PHP illustration program DateTimeImmutable::setISODate()
// function 
// Create a new DateTimeImmutable() $datetimeImmutable = new DateTimeImmutable();  
// Calling the setISODate() function // with parameters such as 2019
// week 9 and day 3 $a = $datetimeImmutable -> setISODate (2019, 9, 03);  
// Get a new set of dates in // format ’ Ymd ’ echo $a -> format ( ’ Ymd’ ); ?>
Output:
2019-02-27
Link: https://www.php.net/manual/en/datetimeimmutable.setisodate.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method