Here’s a little snippet of PHP that will help anyone grappling with a project that involves (or will be used in) multiple timezones.

Other methods along the same lines often require you to set the timezone of your local php installation, do whatever calculations you need to do, and then set the timezone back to the default. This is obviously a little tiresome and could cause some confusion if you forget to set it back! This method involves the creation of a DateTimeZone() object which will take any timezone identifier (GMT, Europe/London, EST etc) and allow you to display times and perform other operations. The code is as follows:

$timezone = new DateTimeZone( "Europe/London" );
$date = new DateTime();
$date->setTimezone( $timezone );
echo  $date->format( 'H:i:s A  /  D, M jS, Y' );

The will display the time and date for the Europe/London timezone regardless of what timezone your php install/server is set to. This will work for any php supported timezone.