处理时间函数整理

Date() 返回当前日期,格式-中国标准时间
new Date() 返回当前日期,格式-中国标准时间
new Date(time) 格式化time为中国标准时间
time.getDate() 获取时间对象的日份
time.getDay() 获取时间对象的星期
time.getFullYear() 获取时间对象的年份
time.getHours() 获取时间对象的小时数
time.getTime() 获取时间对象的时间戳,时间对象必须是标准时间格式
Date.parse(time)     获取时间对象的时间戳,时间对象格式不限
设置日期(格式标准时间)
1、setDate()
——设置 Date 对象中月的某一天 (1 ~ 31)。
2、setMonth()
——设置 Date 对象中月份 (0 ~ 11)。
3、setFullYear()
——设置 Date 对象中的年份(四位数字)。
4、setHours()
——设置 Date 对象中的小时 (0 ~ 23)。
5、setMinutes()
——设置 Date 对象中的分钟 (0 ~ 59)。
6、setSeconds()
——设置 Date 对象中的秒钟 (0 ~ 59)。
7、setMilliseconds()
——设置 Date 对象中的毫秒 (0 ~ 999)。
8、setTime()
——以毫秒设置 Date 对象。
 
posted @ 2018-12-03 17:07  楼下小黑嘿嘿嘿  阅读(266)  评论(0编辑  收藏  举报