码迷,mamicode.com
首页 > Web开发 > 详细

js日期操作

时间:2017-06-02 22:56:10      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:rip   today   type   page   tutorial   com   index   document   als   

Javascript Data Type How to - Add days to current date








Question

We would like to know how to add days to current date.

Answer


<!--from   w  ww .  j a v a2s  . co  m-->
<!DOCTYPE html>
<html>
<head>
<script type=‘text/javascript‘>
window.onload=function(){
    var today = new Date();
    var newdate = new Date();
    newdate.setDate(today.getDate()+29);
    document.writeln(newdate);
}
</script>
</head>
<body>
</body>
</html>

The code above is rendered as follows:

js日期操作

标签:rip   today   type   page   tutorial   com   index   document   als   

原文地址:http://www.cnblogs.com/oxspirt/p/6935297.html

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