var myDate = new Date();
myDate.getDate();       //获取当前日(1-31)
myDate.getFullYear();   //获取完整的年份(4位,1970-????)
myDate.getDate();       //获取当前日(1-31)
这个三个都给你了,剩下的就是你组合了!!

解决方案 »

  1.   

    错了...是1,3,5,7,8,10,12的31,或者,3月的28,9+<script type="text/javascript">
    var d = new Date(2008, 11, 31);
    d.setMonth(d.getMonth() - 1);
    alert(d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate());
    </script>这样解决?
      

  2.   

    <script>
    var now = new Date();
    alert(now.toLocaleString())
    now.setMonth(now.getMonth()-1);
    alert(now.toLocaleString())
    </script>
      

  3.   

    <script> 
    var now = new Date(2008,11,31); 
    alert(now.toLocaleString()) 
    now.setMonth(now.getMonth()-1); 
    alert(now.toLocaleString()) 
    </script>
    这样就不对了