PHP Date Time Tips - Part 13: Do you want to know the local time in another time zone? Write a PHP function to calculate the time in the specified zone. Like this:
<?
function getLocalTime($tm, $offset){
return ($tm - date("Z", $tm)) + (3600 * $offset);
}
// get current local time in Singapore
echo date("H:i:s d-m-y", getLocalTime(mktime(), 8)). "<br>";
// get current local time in bangkok
echo date("H:i:s d-m-y", getLocalTime(mktime(), 7)). "<br>";
// get current local time in USA (Pasific)
echo date("H:i:s d-m-y", getLocalTime(mktime(), -8)). "<br>";
?>