function getTime(){ var myDate = new Date(); var y = myDate.getFullYear(); var m = myDate.getMonth()+1; var d = myDate.getDate(); var h = myDate.getHours(); var f = myDate.getMinutes(); var s = myDate.getSeconds(); if(h<10){h='0'+h;} if(f<10){f='0'+f;} if(s<10){s='0'+s;} return y+'/'+m+'/'+d+' '+h+':'+f+':'+s; } var times = getTime(); document.write(times);