code to format a date in JavaScript.
let objectDate = new Date(); let day = objectDate.getDate(); console.log(day); // 12 let currentmo = objectDate.getMonth(); month = currentmo + 1; console.log(month + 1); // 1 let year = objectDate.getFullYear(); console.log(year); // 2023 // Now you can set it accordingly // dd/mm/yyyy console.log(day + '/' + month + '/' + year); // mm/dd/yyyy console.log(month + '/' + day + '/' + year);