converting date from Date(milliseconds) to dd-mm-yyyy formate in javascript

If we have date in Date(milliseconds) format e.g. Date(1286821800000) & we want to convert it to dd-mm-yyyy format then we can use bellow code.


var singledate = "/Date(1286821800000)/";
var changeddate = singledate.match(/\d+/g).map(function (s) { return new Date(+s); });
var date = new Date(changeddate),
var mnth = ("0" + (date.getMonth() + 1)).slice(-2),
var day = ("0" + date.getDate()).slice(-2);
var ddmmyyyFromateDate = [day, mnth,date.getFullYear()].join("-");

Like this it will get converted to dd-mm-yyyy format from Date(milliseconds) format.