In below section you will find a way to convert JSON date into normal date.
I was looking for a way so that I can convert a JSON date into a normal date format. Below code can help you achieving this.
Copy below code snippet to your js file. It will definitely work for you.
//Method convert JSON date into normal date
//input parameter as JSON date string, date pattern
function convertJSONDateToStringDate (JSONDate, pattern){
var dd=String(date.getDate()); if(dd<10){ dd='0'+dd };
mm=String(date.getMonth()+1); if(mm<10) { mm='0'+mm };
yyyy=String(date.getFullYear());
pattern=pattern.toLowerCase();
pattern=pattern.replace(patternDay, dd);
pattern=pattern.replace(patternMonth, mm);
pattern=pattern.replace(patternYear, yyyy);
return pattern;
}
var date = convertJSONDateToStringDate('1516838400000','dd-mm-yyyy');
console.log("Date is:"+ date);
Output: "25-12-2017"
Hope it helps you..