js计算指定日期的下一年的日期

Posted 大白萝卜

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js计算指定日期的下一年的日期相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <script>
            var d2=new Date("2012-03-1"); 
            d2.setFullYear(d2.getFullYear()+1); 
            d2.setDate(d2.getDate()-1); 
            alert(d2.toLocaleString());
        </script>
    </body>
</html>

 

以上是关于js计算指定日期的下一年的日期的主要内容,如果未能解决你的问题,请参考以下文章