(function(){
var startDay = new Date(2014,8,1); //根据指定的年月日时分秒设置开学时间为2014/09/01
var startMs = startDay.getTime();//返回1970年至今的毫秒
var startYear = startDay.getFullYear();//从Date对象以四位数字返回年份
var startMonth = startDay.getMonth()+1; //从Date对象返回年份(0-11)
var startDate = startDay.getDate(); // 从Date对象返回一月中的某一天(1~31)
var nowDay = new Date();
var nowMs = nowDay.getTime();
var nowYear = nowDay.getFullYear();
var nowMonth = nowDay.getMonth()+1;
var nowDate = nowDay.getDate();
var startDays = parseInt(startMs/86400000);
var nowDays = parseInt(nowMs/86400000);
var totalDays = nowDays - startDays;
var week = parseInt(totalDays/7)+1;
var nowdate = nowDay.getDay();
msg1 = "开学时间:" + startYear + " 年 " + startMonth + " 月 " + startDate + "日";
document.write(msg1);
document.write("
")
msg2 ="现在时间:" + nowYear + " 年 " + nowMonth + " 月 " + nowDate + "日";
document.write(msg2);
document.write("
");
msg3 = "第" + week + "周,星期" + nowdate;
document.write(msg3);
})();