1、常用时间函数
let now = new Date();
console.log(now); // 输出:Wed Jan 02 2019 11:55:21 GMT+0800 (中国标准时间)
console.log(now.toDateString()); // 日期字符串,输出:Wed Jan 02 2019
console.log(now.toGMTString()); // 格林威治时间,输出:Wed, 02 Jan 2019 03:55:21 GMT
console.log(now.toISOString()); // 国际标准组织(ISO)格式,输出:2019-01-02T03:55:21.278Z
console.log(now.toJSON()); // 输出:2019-01-02T03:55:21.278Z
console.log(now.toLocaleDateString()); // 转换为本地日期格式,视环境而定,输出:2019/1/2
console.log(now.toLocaleString()); // 转换为本地日期和时间格式,视环境而定,输出:2019/1/2 上午11:55:21
console.log(now.toLocaleTimeString()); // 转换为本地时间格式,视环境而定,输出:上午11:55:21
console.log(now.toString()); // 转换为字符串,输出:Wed Jan 02 2019 11:55:21 GMT+0800 (中国标准时间)
console.log(now.toTimeString()); // 转换为时间字符串,输出:11:55:21 GMT+0800 (中国标准时间)
console.