开发者

Type casting to datetime

I got data开发者_JS百科 from JSON like "/Date(1285871400000)/" ,but i want to convert in "dd/mm/yyyy".


To answer my own question from the comments.. someone makes the effort to provide a solution (+ he is candidating to be a moderator on SO :p)

var data     = "/Date(1285871400000)/",
    stamp    = /Date\((\d+)\)/.exec(data),
    date     = new Date(+stamp[1]);

alert(date.getDate() + "/" + date.getMonth() + "/" + date.getFullYear());
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜