Can anyone kindly enlighten me on how to get previous day's date in 'YYYY-MM-DD' format using Lua?
I.E., a snippet that will return the date of the previous day from the day during which it is run.
Can anyone kindly enlighten me on how to get previous day's date in 'YYYY-MM-DD' format using Lua?
I.E., a snippet that will return the date of the previous day from the day during which it is run.
Try
print(os.date("%Y-%m-%d",os.time()-24*60*60))
Strictly speaking this is only guaranteed to work on a POSIX system, but it probably works in most systems.
There is a library LuaDate which can be very helpful for Date Manipulations http://luaforge.net/projects/date/
It is very easy to use, since it is documented well!