function regDate(stamp) {
let date = new Date(stamp),
year = date.getFullYear(),
month = (("0" + (date.getMonth() + 1)).slice(-2)),
day = (("0" + (date.getDate())).slice(-2))
return `${day}.${month}.${year}`;
}
console.log(regDate("9.6.2004")) //Выводит: 06.09.2004