date_isodate_set


php apg

SETS a date according to the ISO 8601 standard.



<?php

/* - - - - - - - - - - - - - - - - -

    Object oriented style
   
   - - - - - - - - - - - - - - - - - */

DateTime public DateTime::setISODate int $year 
                                                              
int $week 
                                                              
int $dayOfWeek )

where,

$year The year of the date

$week 
The week of the date

$day 
Offset from the first day of the week

?>

<?php

/* - - - - - - - - - - - - - - - - -

      Procedural style
   
   - - - - - - - - - - - - - - - - - */

DateTime date_isodate_set DateTime $object 
                                                      
int $year 
                                                      
int $week 
                                                      
int $dayOfWeek )


where,

$object The DateTime object

$year 
The year of the date

$week 
The week of the date

$day 
The day of the date

?>

 $object 


A DateTime object.



 $year 


The $year of the related date.



 $week 


The $week of the related date.



 $day 


The offset from the first day of the $week.





For Procedural style, only: A DateTime object returned by the function date_create.
The function modifies this object.

This function use weeks and day offsets rather than specific dates.

The DateTime object for method chaining or FALSE on failure.



  1 EXERCISE   

<?php

date_default_timezone_set
('America/Los_Angeles'); 

$dttm001 = new DateTime();

$year idate('Y');
$month idate('m');
$day idate('d'); 

$nwtm001 $dttm001->setISODate($year$month$day);

echo 
$dttm001->format(DateTimeInterface::ATOM);

?> 

  2 EXERCISE   

<?php

date_default_timezone_set
('America/Los_Angeles');

$dttm002 date_create();

$year idate('Y');
$month idate('m');
$day idate('d');  

$nwtm002 date_isodate_set($dttm002$year$month$day); 

echo 
$dttm002->format('Y-m-d\TH:i:sP');

?> 

  3 EXERCISE   

<?php

date_default_timezone_set
('America/Sao_Paulo');

$dttm003 date_create();

$year idate('Y');
$month idate('m');
$day idate('d'); 

$nwtm003 date_isodate_set($dttm003$year$month$day);

echo 
$dttm003->format('Y-m-d\TH:i:sP');

?>