1 $(function(){ 2 var myDate = new Date; 3 var year = myDate.getFullYear();//获取当前年 4 var yue = myDate.getMonth()+1;//获取当前月 5 var date = myDate.getDate();//获取当前日 6 var h = myDate.getHours();//获取当前小时数(0-23) 7 var m = myDate.getMinutes();//获取当前分钟数(0-59) 8 var s = myDate.getSeconds();//获取当前秒 9 })