// 日期函數 function CurentTime() { var now = new Date(); var year = now.getFullYear(); //年 var month = now.getMonth() + 1; //月 var day = now.getDate(); //日 var hh = now.getHours(); //時 var mm = now.getMinutes(); //分 var myweekday = now.getDay(); //周 var clock = year + "-"; if(month < 10) clock += "0"; clock += month + "-"; if(day < 10) clock += "0"; clock += day + " "; if(hh < 10) clock += "0"; clock += hh + ":"; if (mm < 10) clock += '0'; clock += mm; if(myweekday == 0) clock += " 星期日 "; else if(myweekday == 1) clock += " 星期一 "; else if(myweekday == 2) clock += " 星期二 "; else if(myweekday == 3) clock += " 星期三 "; else if(myweekday == 4) clock += " 星期四 "; else if(myweekday == 5) clock += " 星期五 "; else if(myweekday == 6) clock += " 星期六 "; return(clock); }