一、定义:Date 对象用于处理日期和时间,首字母大写的内置函数是构造函数
二、应用
1、返回当前日期和时间
2、返回指定日期和时间
格式有多种,但是必须为字符串,如果是数字类型,月从0开始计算即0为1月
(1)字符串类型的多种格式
参照格式:MM DD,YYYY,hh:mm:ss
(2)数字型时
3、Date的常用方法
(1)返回年
timer.getFullYear()
(2)返回月
timer.getMonth()
(3) 返回日
timer.getDate()
(4) 返回星期
timer.getDay()
(5) 返回小时
timer.getHours()
(5) 返回分钟
timer.getMinutes()
(6) 返回秒
timer.getSeconds()
4、毫秒的获取(时间戳)