SOURCE

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(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("======================================");
var oMyDay=new Date();
oMyBirthday.setFullYear(2022);
oMyBirthday.setMonth(2);
oMyBirthday.setDate(22);
writeDocument("今天是"+week[oMyDay.getDay()]);
oMyBirthday.setHours(8);
oMyBirthday.setMinutes(55);
writeDocument(oMyDay);

var oDate=new Date(2022,2,22,8,55);
writeDocument("年:"+oDate.getFullYear());
writeDocument("月:"+(oDate.getMonth()+1));
writeDocument("日:"+oDate.getDate());
writeDocument("时:"+oDate.getHours());
writeDocument("分:"+oDate.getMinutes());
 writeDocument("今天是"+week[oDate.getDay()]);

 writeDocument("======================================");
 
console 命令行工具 X clear

                    
>
console