中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

JavaScript獲取某年某月的最后一天

2018-07-20    來源:open-open

容器云強(qiáng)勢上線!快速搭建集群,上萬Linux鏡像隨意使用
    <!DOCTYPE html>  
    <!--  
    To change this license header, choose License Headers in Project Properties.  
    To change this template file, choose Tools | Templates  
    and open the template in the editor.  
    -->  
    <html>  
        <head>  
            <title>JavaScript獲取某年某月的最后一天</title>  
            <meta charset="UTF-8">  
            <meta name="viewport" content="width=device-width">  
            <script type="text/javascript">  
                  /**  
                   * 獲取某年某月的最后一天  
                   */  
                  function getLastDayOfMonth(year,month)  
                  {  
                      //獲取本年本月的第一天日期  
                      var date = new Date(year,month-1,'01');  
                      //設(shè)置日期  
                      date.setDate(1);  
                      //設(shè)置月份  
                      date.setMonth(date.getMonth() + 1);  
                      //獲取本月的最后一天  
                      cdate = new Date(date.getTime() - 1000*60*60*24);  
                      //打印某年某月的最后一天  
                      alert(cdate.getFullYear()+"年"+(Number(cdate.getMonth())+1)+"月最后一天的日期:"+cdate.getDate()+"日");   
                      //返回結(jié)果  
                      return cdate.getDate();  
                  }  
            </script>  
        </head>  
        <body>  
            <input type="button" value="獲取某年某月的最后一天" onclick="getLastDayOfMonth(2014,6)"/>  
        </body>  
    </html>  

標(biāo)簽:

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:通過php的 similar_text函數(shù)比較兩個(gè)字符串的相似性

下一篇:簡單的php抽獎代碼