lua Gets the specified date, how many days (including leap month)

tags: lua

-------------------------------------------------------------------------
- Get the number of days specified date
--------------------------------------------------------------------------
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

 

Intelligent Recommendation

C language java judges leap year, how many days there are in a month

result: Java determines how many days there are in a month Result:...

Shell Gets the date of the specified date N days / month / year (then)

0 preface We sometimes write batch processingShell When the script is required, you may need to get the date before the specified date (later) N days / month, where N can be 1 day / month / year, 2 da...

More Recommendation

Python specifies the number of days in the month, the specified date is a few days, the specified month has several Sundays, leap year Calender

Python specifies the number of days in the month, the specified date is a few days, the specified month has several Sundays, leap year Calender 1, the number of days of the specified month 2, the spec...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top