我是lua脚本的新手.我有一个startDate(“03-05-2014”作为“dd-mm-yyyy”)和几天的跨度(2)任何人都可以帮助我如何根据startDate和span获得endDate? Example startDate span endDate --------- ---- ------- 03-05-2
Example startDate span endDate --------- ---- ------- 03-05-2014 2 05-05-2014 (dd-mm-yyyy) (dd-mm-2014)这可以帮到你
local dayValue, monthValue, yearValue = string.match('31-05-2014', '(%d%d)-(%d%d)-(%d%d%d%d)') dayValue, monthValue, yearValue = tonumber(dayValue), tonumber(monthValue), tonumber(yearValue) now = os.time{year = yearValue, month = monthValue, day = dayValue} numberOfDays = now + 2 * 24 * 3600 print(os.date("%c",numberOfDays)) dateAfterNumberOfDays = os.date("%a %d %B %Y, %H%p%M",numberOfDays) print ("\nafter number of days "..dateAfterNumberOfDays) -- give you date after number of days