UPDATE: Better code. Creds for this updated code to my buddy Seth Furchgott who did the googling and grabbed the following from PHP.net, much better than what I originally posted below.

<?php

date_default_timezone_set(‘America/New_York’);
echo date(‘g:i A’);

?>

Documentation for timezones:

http://us3.php.net/manual/en/timezones.php (get time zones here by Continent…and Ocean)

http://us3.php.net/manual/en/timezones.america.php (US timezones)


OLD PHP TIME POSTS (newer PHP timezone post): 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…

<?php

$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.

Comments/feedback are invited.