开发者

Convert serialized C# DateTime to JS Date object

How can I convert that date format开发者_如何学Go /Date(1302589032000+0400)/ to JS Date object?


Remove the text first:

var src = "/Date(1302589032000+0400)/";

//Remove all non-numeric (except the plus)
src = src.replace(/[^0-9 +]/g, ''); 

//Create date
var myDate = new Date(parseInt(src));

Here's a workding jsFiddle

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜