function time() {
//得到日期实例对象
let obj = new Date;
//获取年月日,时分秒
let a = obj.getFullYear();
let b = obj.getMonth() + 1; //月份从0月开始,所以需要+1
let c = obj.getDate();
let d = obj.getHours();
let e = obj.getMinutes();
let f = obj.getSeconds();
console.log(`${a}年${b}月${c}日${d}点${e}分${f}秒`); //字符串模板打印当前年月日,时分秒。
}
time() ;