It sets the time zone for the DateTime object
Example
<?php
$date1 = new DateTime(‘2000-01-01’, new DateTimeZone(‘Asia/Calcutta’));
echo $date1->format(‘Y-m-d H:i:sP’) . “<br />”;
$date1->setTimezone(new DateTimeZone(‘Australia/Perth’));
echo $date1->format(‘Y-m-d H:i:sP’) ;
?>
Output
2000-01-01 00:00:00+05:30
2000-01-01 02:30:00+08:00