function formatDate(date)
{
var d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2)
month = '0' + month;
if (day.length < 2)
day = '0' + day;
return [day, month, year].join('.');
}
OUTPUT: 19.05.2024
NOTE: If you make the return like that: [day, month, year].join(‘-‘); then the OUTPUT will be: 19-05-2024
