lua 獲取指定年月有多少天(包括閏月)
阿新 • • 發佈:2018-12-09
------------------------------------------------------------------------- -- 獲取指定年月有多少天 -------------------------------------------------------------------------- function getDayByYearMonth(_year, _month) local _curYear = tonumber(_year) local _curMonth = tonumber(_month) if not _curYear or _curYear <= 0 or not _curMonth or _curMonth <= 0 then return end local _curDate = {} _curDate.year = _curYear _curDate.month = _curMonth + 1 _curDate.day = 0 local _maxDay = os.date("%d",os.time(_curDate)) return _maxDay end