var date = new Date();
let format = date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate();
console.log(format); // result : 2021-10-28
Now I want to set it's hours and minutes as 00:00 and 23:59. Example: 2021-10-28 00:00 and 2021-10-28 23:59 ,Thanks