I am trying to send the time to flash but set to the currently timezone. When you view the below even though the echo date, looks like its working the $time
is the same. When i test in flash I get the extra hour added. Any help tips welcome on this one...
$format = "d/m/Y H:m:s";
$timezone = "Europe/Amsterdam";
date_default_timezone_set($timezone);
echo "<h1>Timezone ".$timezone."</h1>";
$date = date($format);
echo "<h3>Date: ".$date."<h3>";
$time = strtotime($date);
echo "<h3>Time: ".$time."<h3>";
$date2 = date($format, $time);
echo "<h3>Reverse: ".$date2."<h3>";
$timezone = "Europe/London";
date_default_timezone_set($timezone);
echo "<h1>Timezone ".$timezone."</h1>";
$date = date($format);
echo "<h3>Date: ".$date."<h3>";
$time = strtotime($date);
echo "<h3>Time: ".$time."<h3>";
$date2 = date($format, $time);
echo "<h3>Reverse: ".$date2."<h3>";
?>
Can't you use the PHP time() object for this? Pass this value:
time()."000" // note the trailing zeroes
Call that serverTime and pass it as a query string:
echo "myFlashFile.swf?serverTime=".time()."000";
Then in your Actionscript:
myDate = new Date();
myDate.setTime(serverTime);
Would some sort of mathematics solve the day? ie:
$time = date("U")+date("Z");
This would work for the timezone ahead, but not so good for behind