Flex 4 utc日期时间格式问题
|
这是我的函数,当timeoffset是整数(1,2,3,4 ...)时,它们工作正常,但是当是3.5(3:30),4.5(4:30)时,它不起作用。
有人可以帮我弄这个吗 :
private function init_vars():void
{
timeZoneOffset = FlexGlobals.topLevelApplication.parameters.clock_time_zone; // I load this with js
timeZoneOffset = 5,50; // just for test
}
private function tick(event:TimerEvent):void
{
var local: Date = new Date();
var utc: Date = new Date(local.getTime() + (local.getTimezoneOffset() * 60000));
var utcTime:Number=utc.getTime();
var new_offset_date:Number = utcTime + ((3600000) * timeZoneOffset);
var new_date:Date = new Date(new_offset_date);
currentTime = new Date(new_date);
showTime(currentTime); // another function just to display time
}
private function showTime(time:Date):void
{
seconds = time.getSeconds();
minutes= time.getMinutes();
hours= time.getHours();
//rotate
this.secondsPointer.rotation = (seconds * 6) - 90;
this.minutesPointer.rotation = (minutes * 6) - 90;
this.hoursPointer.rotation = (hours * 30) + (minutes * 0.5) - 90;
this.secondsPointer.visible = true;
this.minutesPointer.visible = true;
this.hoursPointer.visible = true;
}
没有找到相关结果
已邀请:
1 个回复
董碘奴星
,因为我没有您的
函数,是否有可能是该函数中的错误? 如果可以的话,我建议尝试以下方法:
使用时间(以毫秒为单位)修改日期,具体取决于您实际使用应用程序的方式/位置/时间,可能会在日光节约时产生奇怪的错误。而且,您不想处理仅在世界某些国家/地区可能每年仅发生两次的bug。