Logic Machine Forum
time range verification - 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: time range verification (/showthread.php?tid=3413)



time range verification - Frank68 - 10.06.2021

Hello

I'm trying with a script to check if I'm within a certain time frame, which crosses midnight.

In practice, if I am in the range between 20.00 and 06.00 the next day I must have true.

then I will replace the fixed values with settable values, which way to follow?

Thanks so much


RE: time range verification - Seijboldt - 10.06.2021

Here's an exerpt where I'm checking if the time is between 0200 and 0700 hours, you can modify this to do what you need. 

now = os.date('*t')
time = {hour = now.hour,}

if time.hour > 2 and time.hour < 7 then *do stuff*
else  *do stuff*
end


RE: time range verification - admin - 10.06.2021

The above example is correct but if you also need minutes in the range then check this example: https://forum.logicmachine.net/showthread.php?tid=1439&pid=21201#pid21201


RE: time range verification - Frank68 - 10.06.2021

(10.06.2021, 09:27)admin Wrote: The above example is correct but if you also need minutes in the range then check this example: https://forum.logicmachine.net/showthread.php?tid=1439&pid=21201#pid21201

tkank's