码迷,mamicode.com
首页 > 其他好文 > 详细

日期对象的时间推迟

时间:2019-03-05 21:08:22      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:--   get   time()   就是   定义   write   rip   text   class   


<script type="text/javascript"> var mydate=new Date(); //定义日期对象
document.write("当前时间:"+mydate+"<br>");
mydate.setTime(mydate.getTime() + 60 * 60 * 1000); 设置获取的日期推迟-->>

注意:

 1. 一小时 60 分,一分 60 秒,一秒 1000 毫秒  

 2. 时间推迟 1 小时,就是: “x.setTime(x.getTime() + 60 * 60 * 1000);”

 3.如果是超过1 个小时,为2 小时,3 小时。。。。  则需在时间前加 {(整时*)*60 * 60 * 1000}    代码为-->>  “x.setTime(x.getTime() +  2 * 60 * 60 * 1000);”

日期对象的时间推迟

标签:--   get   time()   就是   定义   write   rip   text   class   

原文地址:https://www.cnblogs.com/Glant/p/10479663.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!