How to convert JSON date from REST
/Date(1480525200000+0700)/
to string format dd/MM/yyyy
How to convert JSON date from REST
/Date(1480525200000+0700)/
to string format dd/MM/yyyy
Three years ago:
I would highly recommend using moment.js for all your date handling.
…but now:
I consider date-fns a much better choice. Lighter and does not require a dedicated object.
Create a new date from the milliseconds
let today = new Date(1480525200000);
let dd = today.getDate();
let mm = today.getMonth()+1; //January is 0!
let yyyy = today.getFullYear();
let sdd; let smm; let stoday;
if(10>dd) {sdd='0'+dd;} else{sdd=dd;}
if(10>mm) {smm='0'+mm;} else{smm=mm;}
stoday = sdd + '/' + smm + '/' + yyyy ;
good luck