獲取某個月的天數

// 使用方法// alert(monthDate(2018,5))
function $monthDate(year, month) {
    // 獲取某個月的天數
    var time = new Date(year + "/" + month + "/1");
    var time2 = new Date(year + "/" + (month + 1) + "/1");
    var zms1 = time.getTime();
    var zms2 = time2.getTime();
    var zms = ((zms2 - zms1) / 1000 / 3600 / 24) + "天";
    return zms;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章