日期对象
Date 对象用于处理日期和时间。
通过 new 关键词来定义 Date 对象。 var data = new Date()
方法总结
toString() 方法可把 Date 对象转换为字符串,并返回结果。
toLocaleString() 方法可根据本地时间把 Date 对象转换为字符串,并返回结果。
valueOf() 方法返回 Date 对象的原始值。
getTime() 方法可返回距 1970 年 1 月 1 日之间的毫秒数。
setTime() 方法以毫秒设置 Date 对象。
getFullYear() 方法可返回一个表示年份的 4 位数字。
setFullYear() 方法用于设置年份。
getMonth() 方法可返回表示月份的数字。
setMonth() 方法用于设置月份。
getDate() 方法可返回月份的某一天。
setDate() 方法用于设置一个月的某一天。
getDay() 方法可返回表示星期的某一天的数字。
getHours() 方法可返回时间的小时字段。
getMinutes() 方法可返回时间的分钟字段。
getSeconds() 方法可返回时间的秒。
getMilliseconds() 方法可返回时间的毫秒。