DateTime::getTimezone

It return time zone relative to given DateTime
Example

<?php
$date1 = new DateTime(null, new DateTimeZone(‘Asia/Calcutta’));
$timezone = $date1->getTimezone();
echo $timezone->getName();
?>

Output

Asia/Calcutta

Share