Logic Machine Forum
os.date -1 day - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: os.date -1 day (/showthread.php?tid=5790)



os.date -1 day - Joep - 13.12.2024

Hi all,

I'm using this line of script to compare the date i get from value.date with the os.date
That part is working fine but now i want a second function where i can do some action one day before. This script is running once a day checking a list with dates to compare.
 
Code:
if value.date == os.date("%Y-%m-%d") then
  --do something
end

Thanks in advance,

Joep


RE: os.date -1 day - admin - 13.12.2024

Use this:
Code:
time = os.time() - 24 * 60 * 60
date = os.date('%Y-%m-%d', time)



RE: os.date -1 day - Joep - 13.12.2024

(13.12.2024, 14:36)admin Wrote: Use this:
Code:
time = os.time() - 24 * 60 * 60
date = os.date('%Y-%m-%d', time)

Thank you admin for your quick reply and answer.