var dt=new date(); var y=dt.getfullyear(); var m=dt.getmonth()+1; var d=dt.getdate(); var h=dt.gethours(); var mi=dt.getminutes(); var w=dt.getday(); var md=m+"-"+d; var wek=new array("0:星期日","1:星期一","2:星期二","3:星期三","4:星期四","5:星期五","6:星期六"); var datecontent=""+y+"年"+m+"月"+d+"日 "+week(wek,w); document.write(datecontent); function week(wek,w) { var a; for(i=0;i