js獲取本月最后一天


function getLastDay() {     
  var seperator1 = "-";     
  var date=new Date;     
  var new_month = date.getMonth()+1;    
   var new_year = date.getFullYear();    
   //取當前的年份     
  var new_date = new Date(new_year,new_month,1);               
   //取當年當月中的第一天     
  // (new Date(new_date.getTime()-1000*60*60*24)).getDate();//獲取當月最后一天日期                                             var currentdate = new_year + seperator1 + new_month + seperator1 +(new Date(new_date.getTime()-1000*60*60*24)).getDate();           
   return currentdate;
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM