var myDate = new Date; var year = myDate.getFullYear();//獲取當前年 var yue = myDate.getMonth()+1;//獲取當前月 var date = myDate.getDate();//獲取當前日 var h = myDate.getHours();//獲取當前小時數(0-23) var m = myDate.getMinutes();//獲取當前分鐘數(0-59) var s = myDate.getSeconds();//獲取當前秒