How to display only Date From JavaScript Date Time?

The Logic: JavaScript date object has methods to extract the date, month, and year. We’ll utilize it to build the date from the DateTime.

function getDate(dateTime){
	return `${dateTime.getDate()}-${dateTime.getMonth() + 1}-${dateTime.getFullYear()}`
}

console.log('Date is ', getDate(new Date()));
// "Date is ", "25-11-2020"

getMonth method returns the month index from 0 to 11 from January to December respectively. That’s why it’s been incremented by 1 for display. You can refer to how to format DateTime using JavaScript for a different date-time format.