计算一年后的日期

<!DOCTYPE html>
<html>
<head>
    <title>日期计算</title>
</head>
<body>
<script type="text/javascript"> var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; var nowDate=new Date(); nowDate.setMonth(nowDate.getMonth()+12); document.write("Date 12 months ahead is "+nowDate.getDate()); document.write(" "+months[nowDate.getMonth()]); document.write(" "+nowDate.getFullYear());
</script> </body> </html>

 

posted @ 2017-11-12 15:43  勤奋的园  阅读(1189)  评论(0编辑  收藏  举报