Use the standard datefeature with date_default_timezone_set.
$timezones = array("Australia/Brisbane", "America/New York", "Europe/London");
foreach ($timezones as $tz) {
date_default_timezone_set($tz);
echo "The time in $tz is: " . date('r');
}
It processes all daily savings and everything for you.
: http://www.php.net/manual/en/timezones.php
: Javascript:
, PHP , , date('Z'), UTC. JSON -, Javascript:
var offsets = {
'Brisbane' : 36000,
'Sydney' : 42000,
'London' : 0
};
, .
for (var city in offsets) {
var d = new Date();
d.setTime(d.getTime() + offsets[city] * 1000);
alert('The time in ' + city + ' is ' + d.toUTCString());
}
, , setInterval
: , , - ( DST). , , , , .