得到时间方法:
getDate() 查看Date对象并返回日期
getDay() 返回星期几
getHours() 返回小时数
getMinutes() 返回分钟数
getMonth() 返回月份值
getSeconds() 返回秒数
getTime() 返回完整的时间
getFullYear() 返回年份
设置时间方法:
setDate() 改变Date对象的日期
setHours() 改变小时数
setMinutes() 改变分钟数
setMonth() 改变月份
setSeconds() 改变秒数
setTime() 改变完整的时间
setFullYear() 改变年份
所以 推迟一个月mydate.setMonth(mydate.getMonth()+1);
提前一小时mydate.setTime( mydate.getTime()- 60 * 60 * 1000);
推迟一年mydate.setFullYear( mydate.getFullYear()+1);
Date 日期对象
猜你喜欢
转载自blog.csdn.net/qq_35036255/article/details/79669220
今日推荐
周排行