用于CV
(function () {
var now = new Date();
console.log("now", now);
var millsecond = Date.UTC(1980, 1, 3);
var thatNow = new Date(millsecond);
console.log("thatNow", thatNow);
var someDate = Date.parse("May 25,2008");
console.log("someDate", someDate);
var y2k = Date.UTC(2000, 0);
console.log("y2k", y2k);
var start = Date.now();
var stop = +new Date();
console.log(start);
console.log(stop);
var nowDate = new Date();
var year = nowDate.getFullYear();
var month = nowDate.getMonth();
var day = nowDate.getDate();
var week = nowDate.getDay();
var hour = nowDate.getHours();
var minutes = nowDate.getMinutes();
var second = nowDate.getSeconds();
var weekName = ["一","二","三","四","五","六","日"];
console.log(`${year}年-${month+1}月-${day}日,星期${weekName[week]} ${hour}时:${minutes}分:${second}秒`);
var theDate = new Date();
console.log(theDate.toDateString());
console.log(theDate.toTimeString());
console.log(theDate.toLocaleDateString());
console.log(theDate.toLocaleTimeString());
console.log(theDate.toUTCString());
})();
|