SOURCE

function writeDocument(variable) {
    document.write(variable + "<br/>");
}

var today = new Date();
writeDocument(today);

writeDocument(today.getFullYear());
writeDocument(today.getMonth() + 1);
writeDocument(today.getDate());
writeDocument(today.getHours());
writeDocument(today.getMinutes());
writeDocument(today.getSeconds());

var myday = new Date();
myday.setFullYear(2019);
myday.setMonth(6);
myday.setDate(1);
myday.setHours(15);
myday.setMinutes(59);
myday.setSeconds(59, 59);
writeDocument(myday);

writeDocument("今天是星期" + today.getDay());
var week = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
writeDocument("今天是" + week[today.getDay()]);

writeDocument("今天是" + today.getFullYear() + "年" + (today.getMonth() + 1) + "月" + today.getDate() + "日" + week[today.getDay()] + today.getHours() + ":" + today.getMinutes());
console 命令行工具 X clear

                    
>
console