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("设置时间对象的年,月,日,时,分,秒-------")
var oMyBirthday=new Date();
oMyBirthday.setFullYear(2002);
oMyBirthday.setMonth(3);
oMyBirthday.setDate(29);
oMyBirthday.setHours(4);
oMyBirthday.setMinutes(22);
oMyBirthday.setSeconds(23,999);
writeDocument(oMyBirthday);
writeDocument("获取星期几--------------------");
writeDocument("今天是星期"+oToday.getDay());
var week=["星期天","星期一","星期二","星期三","星期四","星期五","星期六",];
writeDocument("今天是"+week[oToday.getDay()]);
writeDocument("打印今天是:2019年6月1日 星期六 15:59:59 ---")
var oMyDate=new Date(2019,6,1,15,59);
writeDocument("今天是"+oMyDate.getFullYear()+"年"+(oMyDate.getMonth()+1)+"月"+
oMyDate.getDate()+"日 星期"+(oToday.getDay()+6)+" "+oMyDate.getHours()+":"+oMyDate.getMinutes())
console