I am new to lua scripting. I have a startDate ("03-05-2014"
as "dd-mm-yyyy"
) and a span in days (2
) Can anyone help me how to get the endDate
based on the startDate
and span
?.
Example startDate span endDate
--------- ---- -------
03-05-2014 2 05-05-2014
(dd-mm-yyyy) (dd-mm-2014)
This could help you
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