Set GMT time in flash
[ 2006-07-23 11:39:03 | Author: liuhuan ]
If we get time from local computer in flash , it would be incorrect . Since there's another way to get GMT time in flash :
Create a dynamic textarea in flash , named t1 .
Quote
timezone1 = "GMT +08:00";//Beijing time,you can also dim other GMT time,like:
/*
timezone2 = "GMT -05:00";
timezone3 = "GMT -06:00";
timezone4 = "GMT +01:00";
*/
timedate1 = new Date();
timezone_hours1 = Number(timezone1.substring(5, 7));
timezone_minutes1 = Number(timezone1.substring(8, 10));
if (timezone1.charAt(4) == "-") {
timezone_hours1 = timezone_hours1*-1;
timezone_minutes1 = timezone_minutes1*-1;
}
timedate1.setDate(timedate1.getUTCDate());
timedate1.setHours(timedate1.getUTCHours()+timezone_hours1);
timedate1.setMinutes(timedate1.getUTCMinutes()+timezone_minutes1);
var hour1 = timedate1.getHours();
var minutes1 = timedate1.getMinutes();
var seconds1 = timedate1.getSeconds();
t1=hour1+":"+minutes1+":"+seconds1
/*
timezone2 = "GMT -05:00";
timezone3 = "GMT -06:00";
timezone4 = "GMT +01:00";
*/
timedate1 = new Date();
timezone_hours1 = Number(timezone1.substring(5, 7));
timezone_minutes1 = Number(timezone1.substring(8, 10));
if (timezone1.charAt(4) == "-") {
timezone_hours1 = timezone_hours1*-1;
timezone_minutes1 = timezone_minutes1*-1;
}
timedate1.setDate(timedate1.getUTCDate());
timedate1.setHours(timedate1.getUTCHours()+timezone_hours1);
timedate1.setMinutes(timedate1.getUTCMinutes()+timezone_minutes1);
var hour1 = timedate1.getHours();
var minutes1 = timedate1.getMinutes();
var seconds1 = timedate1.getSeconds();
t1=hour1+":"+minutes1+":"+seconds1
Comments Feed: http://www.liuhuan.com/blog/feed.asp?q=comment&id=569
There is no comment on this article.
You can't post comment on this article.