1.创建当前时间对象

    1. var d = new Date();
    2. console.log(d); //Sun Jul 11 2021 16:20:05 GMT+0800 (中国标准时间)

    2.创建指定时间对象

             // 需要在构造函数中传递一个表示时间的字符串作为参数
            // 日期格式 月份/日/年/时:分:秒
            var dr = new Date('12/03/2016 11:10:30');
            console.log(dr);  //Sat Dec 03 2016 11:10:30 GMT+0800 (中国标准时间)
    

    image.png