I want to make a system which displays time dependant on the timezone in a particular country. E.g. a table in my database contains country names in one field, and in the column next to it, it will contain GMT-compared timezones like -0100 or -0200.
What I need to do on the webpage then is set current GMT time ($time), and then pull the information from the database and alter $time to be GMT -1 or GMT -2.
Could someone tell me what the easiest way to do this would be please?
Thanks for any help
Edit:
So far I have this code:
<?php
$time = date("H:i:s", time());
echo $time;
echo "<br/><br/>";
$myDateTime = new DateTime($time, new DateTimeZone('GMT'));
$myDateTime->setTimezone(new DateTimeZone('Antarctica/South_Pole'));
echo $myDateTime->format('Y-m-d H:i');
?>
which seems to do the job, and I could enter into the database 'Antarctica/South_Pole' rather than the GMT-/+ time. Would this do the job OK in the long run?
Also, using this method, would Daylight saving times be worked out OK?