apache-flex - Flex Date() 构造函数错误地转换了 Unix 时间戳 argh

标签 apache-flex actionscript-3 actionscript flex3 timestamp

这是严重杀死我。我正在尝试将 Unix 时间戳(1236268800,相当于格林威治标准时间 2009 年 3 月 5 日星期四 16:00:00)转换为 Flex 中的日期对象。

var timestamp:Number = 1236268800;
trace(new Date(timestamp));

Output: Wed Jan 14 23:24:28 GMT-0800 1970

也试过这个:
var timestamp:Number = 1236268800;
var date:Date = new Date;
date.time = timestamp;
trace(date);

Output: Wed Jan 14 23:24:28 GMT-0800 1970

这两种方法中的任何一种都应该有效。我在这里做错了什么?

最佳答案

你必须转换成毫秒,乘以 1000

关于apache-flex - Flex Date() 构造函数错误地转换了 Unix 时间戳 argh,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/544186/

上一篇:BDD和 "when"的位置

下一篇:WPF不释放内存

相关文章:

actionscript-3 - AS3 : two functions with the same name but incompatible signatures from two interfaces

javascript - 将 Actionscript 转换为 Javascript

actionscript-3 - Action 3-ReferenceError : Error #1065: Variable addFrameScript is not defined

ios - iOS 上的 Flash/AIR 舞台视频 - 这可能吗?表现如何?

xml - as3 xml 检查元素是否存在

apache-flex - Flex AdvancedDataGrid - 删除排序箭头

apache-flex - Actionscript 的 Number 类的 toFixed() 方法返回奇怪的值

apache-flex - Flex ComboBox、默认值和数据提供者

apache-flex - invalidateList 和 invalidateDisplayList 有什么区别?

apache-flex - 在 DisplayObjectContainer 上调用 addChild 或 removeChild 方法时会发生什么?