使用ajax数据数组的jquery中的日期格式

时间:2015-02-02 12:17:53

标签: jquery ajax date

如何从以下代码中获取简单的日期格式:

"sAjaxSource": "/ZMWebService/ZMServiceUserRole.asmx/GetUserRoleList",
        "columns": [
                    { "data": "id" },
                    { "data": "RoleName" },
                    { "data": "Description" },
                    { "data": "CreatedBy" },
                    { "data": "CreateDate" },
                    { "data": "ModifiedBy" },
                    { "data": "ModifyDate" },

显示日期如下:

Date(1422729000000)

如何从中获取简单的日期格式。

1 个答案:

答案 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);