date_timezone_set

Its an alias of DateTime::setTimezone()and  sets the time zone for the DateTime object
Example

<?php
$date = date_create(‘2000-01-01’, timezone_open(‘Asia/Calcutta’));
echo date_format($date, ‘Y-m-d H:i:sP’) . “<br />”;
date_timezone_set($date, timezone_open(‘Australia/Perth’));
echo date_format($date, ‘Y-m-d H:i:sP’) ;
?>

Output

2000-01-01 00:00:00+05:30
2000-01-01 02:30:00+08:00

Share