Wednesday, 25 November 2015

Display current datetime in jquery

var today = new Date();

var dd = today.getDate();

var mm = today.getMonth()+1; //January is 0!

var yyyy = today.getFullYear();

var h=today.getHours();

var m=today.getMinutes();

if(dd<10){

dd='0'+dd



}

if(mm<10){

mm='0'+mm



}

var today = mm+'/'+dd+'/'+yyyy+' '+h+":"+m;

$("#lvldate").text(today);