且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将Json日期时间转换为正常日期时间格式?

更新时间:2023-02-03 15:32:04

检查此链接是否有帮助。



http://mvcworld.blogspot.in/2013/06/convert-json-date-to-javascript-日期。 html [ ^ ]
Check this link hope it helps.

http://mvcworld.blogspot.in/2013/06/convert-json-date-to-javascript-date.html[^]


使用新的Date()创建日期对象。



例如。
Date objects are created with new Date().

For example.
var date = new Date(Datestamp);


var date = new Date(parseInt(Datestamp.substr(10)));

这里substr函数取出/ Date(部分,而parseInt函数获取整数并忽略最后的)/。生成的数字将传递给Date构造函数。
var date = new Date(parseInt(Datestamp.substr(10)));
here the substr function takes out the "/Date(" part, and the parseInt function gets the integer and ignores the ")/" at the end. The resulting number is passed into the Date constructor.