.net时间戳转js时间戳


遇到有部分asp.net程序的接口输出为.net时间戳,但需要进行js运算时,由于历法不同,时间戳不能直接使用

var dotNetTimeStamp=getTimeStamp(); //获取.Net输出的时间戳
var timeStamp=new Date();
timeStamp.setTime(Math.floor((dotNetTimeStamp-621355968000000000)/10000-28800000)); //减去.net中1970年1月1日的18位时间戳,缩进4位,减去GMT+8的时间差


评论
peacock feather earrings
Thank you an amazing post, would examine your others posts. i appreciate your ideas with this, I experienced a bit thump by this short article. Thanks again! You make a good moment. Got some wonderful report here. I believe if more people thought of it like this, they'd have a very better moment in time obtain the hang ofing the situation.
Caroline
With all these silly websites, such a great page keeps my itnrenet hope alive.