UPDATE: After a comment from a visitor I re-checked my code, did some testing and added the echo statement with formatted time, and improved the comments about how to check for the correct value of $offset. Also, note I have not used this code for a year yet so I do not know if daylight savings has been taken into account.

PHP code to get time in YOUR timezone…

<?

$mydatetime = time ();
$offset= 0; // offset in # of hours from desired location
// check the time displayed using $offset = 0 and adjust
// the offset accordingly
$mydatetime = $mydatetime + ($offset * 60 * 60);
echo date (“g:i A”, $mydatetime);

?>

Check the PHP Time manual page for formatting the time. This code has only been tested on two implementations. When I wanted to display the local time for a website’s “offical time” I couldn’t find any simple explanations online.

Comments/feedback are invited.