var today = new Date();
Setting date format in d-m-Y
var curDate = today.getDate()+'-'+(today.getMonth()+1)+'-'+today.getFullYear();
Setting date format in Y/m/d
var curDate = today.getFullYear()+'/'+(today.getMonth()+1)+'/'+today.getDate();
Getting current time from Date object in h:i:s format and concatenate with current date.
var curTime = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var curDateTime = today.getDate()+'-'+(today.getMonth()+1)+'-'+today.getFullYear()+" ".today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(); alert(curDateTime); console.log(curDateTime);