首页 > 其他 > 详细

C# 的时间戳 在flash actionscript中使用

时间:2014-08-04 21:41:48      阅读:452      评论:0      收藏:0      [点我收藏+]

目前在做一个项目,要以字节的方式传时间戳到flash中,

错误的就不写了,只写一个可以使用的如下:

C#

            DateTime centuryBegin = new DateTime(1970, 1, 1,0,0,0);
            DateTime currentDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute,DateTime.Now.Second);
            long elapsedTicks = currentDate.Ticks - centuryBegin.Ticks;

输出14071475100000000

flash actionscript

 var d:Date = new Date(0);
			 trace(d);
			 d.setMilliseconds(1407147510000); //14071475100000000传过来的是纳秒10^9,而这里是毫秒
			 trace(d);			 


 

输出
Mon Aug 4 18:18:30 GMT+0800 2014

要注意C#中是纳秒会多出10^4倍

而as中是毫秒1407147510000

C# 的时间戳 在flash actionscript中使用,布布扣,bubuko.com

C# 的时间戳 在flash actionscript中使用

原文:http://blog.csdn.net/dengkanxiao/article/details/38373683

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!