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());
writeDocument("设置年月日时分秒毫秒---------");
var oDate=new Date(2019);
oDate.setFullYear(2020);
writeDocument("年:"+oDate.getFullYear());
oDate.setMonth(5);
writeDocument("月:"+oDate.getMonth()+1);
oDate.setDate(1);
writeDocument("日:"+oDate.getDate());
oDate.setHours(16);
writeDocument("时:"+oDate.getHours());
oDate.setMinutes(58);
writeDocument("分:"+oDate.getMinutes());
oDate.setSeconds(59);
writeDocument("秒:"+oDate.getSeconds());
oDate.setMilliseconds(999);
writeDocument("秒:"+oDate.getMilliseconds());
var weeks=["周日","周一","周二","周三","周四","周五","周六"];
writeDocument("今天是:"+weeks[oToday.getDay()]);
var oPrintDate = new Date(2019, 5, 1, 15, 59, 59, 999);
writeDocument("打印 2019年6月日");
writeDocument("年:"+oPrintDate.getFullYear());
writeDocument("月:"+oPrintDate.getMonth());
writeDocument("日:"+oPrintDate.getDate());
writeDocument("时:"+oPrintDate.getHours());
writeDocument("分:"+oPrintDate.getMinutes());
writeDocument("秒:"+oPrintDate.getSeconds());
writeDocument("毫秒:"+oPrintDate.getMilliseconds());
console