1
2
3
4
5
6 | function getDateFormate(date) {
var now = new Date(date);
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
return (day) + "-" + (month) + "-" + now.getFullYear();
}
|
for getting date in ajax response like this: "/Date(1583787600000)/"
1
2
3
4
5
6 | function getDateFormate(date) {
var now = new Date(date.match(/\d+/)[0] * 1);
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
return (day) + "-" + (month) + "-" + now.getFullYear();
}
|
0 Comments