1var today = new Date();
2var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
3
1var today = new Date();
2 var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
3 console.log(date)
4// output 2021-7-9
1var today = new Date();
2var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
1var d= new Date();
2d.getFullYear();//Get the year as a four digit number (yyyy)
3d.getMonth();//Get the month as a number (0-11)
4d.getDate();//Get the day as a number (1-31)
5d.getHours();//Get the hour (0-23)
6d.getMinutes();//Get the minute (0-59)
7d.getSeconds();//Get the second (0-59)
8d.getMilliseconds();//Get the millisecond (0-999)
9d.getTime();//Get the time (milliseconds since January 1, 1970)