码迷,mamicode.com
首页 > 其他好文 > 详细

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

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

标签:blog   使用   io   2014   ar   cti   时间   new   

目前在做一个项目,要以字节的方式传时间戳到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中使用

标签:blog   使用   io   2014   ar   cti   时间   new   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!