function writeDocument(variable) {
document.write(variable + "<br/>");
}
writeDocument("定义一个时间对象-----------------------------");
var oToday = new Date();
writeDocument(oToday);
writeDocument("获取时间对象的年,月,日,时,分,秒----------");
writeDocument("年:"+oToday.getFullYear());
writeDocument("月:"+(oToday.getMonth()+1));
writeDocument("日: "+oToday.getDate());
writeDocument("时:"+oToday.getHours());
writeDocument("分:"+oToday.getMinutes());
writeDocument("秒:"+oToday.getSeconds());
writeDocument("获取时间对象的年,月,日,时,分,秒(2019-6-1 11:00:58 888)----------");
var oMyBirthday = new Date();
oMyBirthday.setFullYear(2019);
oMyBirthday.setMonth(5);
oMyBirthday.setDate(1);
oMyBirthday.setHours(11);
oMyBirthday.setMinutes(30);
oMyBirthday.setSeconds(58,888);
writeDocument(oMyBirthday);
writeDocument("获取星期几-------------------");
writeDocument("今天是星期"+oToday.getDay());
var week =["星期天","星期一","星期二","星期三","星期四","星期五","星期六",];
writeDocument("今天是"+week[oToday.getDay()]);
writeDocument("请你打印'今天是2022年3月22日 星期二 8:55 ' ----------------");
var oDate=new Date(2022, 2 , 22 , 8 , 55 , 15 , 800);
writeDocument("今天是"+oDate);
writeDocument("请你打印'今天是2022年3月22日 星期二 8:55 ' ----------------");
var today = new Date();
today.getDay(2);
today.setFullYear(2022);
today.setMonth(2);
today.setDate(22);
today.setHours(8);
today.setMinutes(55);
today.setSeconds(58,888);
writeDocument(today);
console