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)
You don't need to do any math here. os.time
and os.date
will do it for you.
local day, month, year = ("03-05-2014"):match("(%d%d)-(%d%d)-(%d%d%d%d)")
local span = 64
local endtime = os.time({day = day + span, month = month, year = year})
print(os.date("%c", endtime))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With