/*
* 获取当前时间
*/
function Less(than) {
return than < 10 ? ‘0‘ + than: than;
}
var myDate = new Date();
var year=myDate.getFullYear();//获取当前年份
var month=myDate.getMonth()+1;//获取当前月份
var date=myDate.getDate(); //获取当日
var h=myDate.getHours(); //获取当前小时数(0-23)
var m=myDate.getMinutes(); //获取当前分钟数(0-59)
var s=myDate.getSeconds(); //获取当前秒数
var now=year+‘-‘+Less(month)+"-"+Less(date)+" "+Less(h)+‘:‘+Less(m)+":"+Less(s);