-1

How can I get simple date format from following code:

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

it is displaying date as follow:

Date(1422729000000)

How can I get simple date format from it.

user692942
  • 16,398
  • 7
  • 76
  • 175

1 Answers1

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);
Sadikhasan
  • 18,365
  • 21
  • 80
  • 122
  • Worth a note about getMonth's return value which is 0-based - therefore the `+1`. Always a good opportunity to shot yourself in the foot. :] – nuala Feb 02 '15 at 12:40