jquery는 연월에 따라 현재 월일 목록을 가져옵니다

9060 단어 jquerytool
function:
        function getDaysByYearAndMonth(date) {  // "2019-07"
            var year = date.split("-")[0];
            var month = date.split("-")[1];
            var  mo = Math.floor(year%4)
            var february = (mo == 0 ? 29 : 28);
            var months = {"01": 31, "02": february, "03": 31, "04": 30, "05": 31, "06": 30, "07": 31, "08": 31, "09": 30, "10": 31, "11": 30, "12": 31}
            var count = months[month];
            var days = new Array(count);
            for (var i = 0; i < count; i++) {
                var j = i + 1;
                days[i] = year + month + (j<10 ? "0"+j : j);
            }
            return days;
        }

참조:
getDaysByYearAndMonth("2016-02")

참조:
["20160201","20160202","20160203","20160204","20160205","20160206","20160207","20160208","20160209","20160210","20160211","20160212","20160213","20160214","20160215","20160216","20160217","20160218","20160219","20160220","20160221","20160222","20160223","20160224","20160225","20160226","20160227","20160228","20160229"]

좋은 웹페이지 즐겨찾기