function writeDocument(variable) {
document.write(variable + "<br/>");
}
writeDocument("定义时间对象-----------------------------------------------------------");
var oToday = new Date();
writeDocument("获取年,月,日,时,分,秒,毫秒-----------------------------------------");
writeDocument("年:" + oToday.getFullYear());
writeDocument("月:" + oToday.getMonth());
writeDocument("日:" + oToday.getDate());
writeDocument("时:" + oToday.getHours());
writeDocument("分:" + oToday.getMinutes());
writeDocument("秒:" + oToday.getSeconds());
writeDocument("毫秒:" + oToday.getMilliseconds() + "<br/>");
writeDocument("设置年,月,日,时,分,秒,毫秒----------------------------------------");
var oDate = new Date(2022);
oDate.setFullYear(2024);
writeDocument("年:" + oDate.getFullYear());
oDate.setMonth(01);
writeDocument("月:" + oDate.getMonth());
oDate.setDate(24);
writeDocument("日:" + oDate.getDate());
oDate.setHours(22);
writeDocument("时:" + oDate.getHours());
oDate.setMinutes(00);
writeDocument("分:" + oDate.getMinutes());
oDate.setSeconds(00);
writeDocument("秒:" + oDate.getSeconds());
oDate.setMilliseconds(02);
writeDocument("毫秒:" + oDate.getMilliseconds() + "<br/>");
var week = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
writeDocument("今天是" + week[oToday.getDay()] + "<br/>");
var oPrintDate = new Date(2022,03,23,22,00,02,06);
writeDocument("打印2022年6月1日 星期六 15:59:59:99------------------------------------");
console