0);DateTime currentDate = new DateTime(DateTime.Now.Year

时间:2021-12-01 04:59:04

错误的就不写了。仅仅写一个能够使用的例如以下:

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

发明时间还是不正确,在flash里输出

?trace(d.timezoneOffset);//-480分钟,也就是恰好8个小时,我加上时差的毫秒数

把上面的设置毫秒数的语句改为

d.setMilliseconds(NowDateTime+d.timezoneOffset*60*1000);

再输出d值:

Tue Aug 5 15:19:52 GMT+0800 2014