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.
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