如何从以下代码中获取简单的日期格式:
"sAjaxSource": "/ZMWebService/ZMServiceUserRole.asmx/GetUserRoleList",
"columns": [
{ "data": "id" },
{ "data": "RoleName" },
{ "data": "Description" },
{ "data": "CreatedBy" },
{ "data": "CreateDate" },
{ "data": "ModifiedBy" },
{ "data": "ModifyDate" },
显示日期如下:
Date(1422729000000)
如何从中获取简单的日期格式。
答案 0 :(得分:1)
var date = "/Date(1422729000000)/".substr(6);
var currentTime = new Date(parseInt(date ));
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
var date = day + "/" + month + "/" + year;
alert(date);