how to get today date in javascript

JavaScript
//parameters will specify date you put to input
// var date = new Date(year, month, day, hours, minutes, seconds, milliseconds);

// show current month
const localDate = new Date();
const months = [
   "January",
   "February",
   "March",
   "April",
   "May",
   "June",
   "July",
   "August",
   "September",
   "October",
   "November",
   "December",
];
let currentMonth = months[localDate.getMonth()];
console.log(currentMonth);

// show current date
const localDate = new Date();
const currentDate = localDate.getDate();
console.log(currentDate);

// show current day
const localDate = new Date();
const days = [
   "Sunday",
   "Monday ",
   "Tuesday",
   "Wednesday",
   "Thursday",
   "Friday",
   "Saturday",
];

const currentDay = days[localDate.getDay()];
console.log(currentDay);let today = new Date().toLocaleDateString()

console.log(today)var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = date+' '+time;
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();

today = mm + '/' + dd + '/' + yyyy;
document.write(today);var d= new Date();
d.getFullYear();//Get the year as a four digit number (yyyy)
d.getMonth();//Get the month as a number (0-11)
d.getDate();//Get the day as a number (1-31)
d.getHours();//Get the hour (0-23)
d.getMinutes();//Get the minute (0-59)
d.getSeconds();//Get the second (0-59)
d.getMilliseconds();//Get the millisecond (0-999)
d.getTime();//Get the time (milliseconds since January 1, 1970)
Source

Also in JavaScript: