如何使用JavaScript在日期中增加月份数?
要在日期中添加月份数,请先使用getMonth()方法获取月份,然后添加月份数。
示例
您可以尝试运行以下代码来添加多个月
<!DOCTYPE html>
<html>
<body>
<script>
var d, e;
d = new Date();
document.write(d);
e = d.getMonth()+1;
document.write("<br>Incremented month = "+e);
</script>
</body>
</html>热门推荐
10 广西考试祝福语结婚简短
11 猪年祝福语简短小孩
12 元旦祝福语送长辈简短
13 恭喜二宝祝福语简短
14 祝福语暖心话简短
15 国庆中秋祝福语简短兄弟
16 朋友订婚的祝福语简短
17 送弟弟中秋祝福语简短
18 爱生日祝福语简短独特