let today = new Date().toLocaleDateString()
console.log(today)
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
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;
The dateTime variable contains result as:
2018-8-3 //11:12:40
// Getting date and time with javascript
// example: 1/11/2021 1:34:29
var currentdate = new Date();
var datetime = currentdate.getDay() + "/" + currentdate.getMonth()
+ "/" + currentdate.getFullYear() + " "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":" + currentdate.getSeconds();
var date = new Date();
date.setDate(date.getDate() + 1);