Page 1 of 1

If time between help

Posted: Thu Jun 13, 2019 6:51 am
by torrington
Hi, I'm trying to make a script that runs only if the time is between for example from 18:00:00pm to 04:00:00am hs.

So far I've got this one working:

:if ([/system clock get time] > "18:00:00") do={}

This one will run if time is past 18:00:00, but what I need now is to "tell" the script to only run if time is between 18:00:00pm to 04:00:00am

Thanks everyone.

Re: If time between help  [SOLVED]

Posted: Thu Jun 13, 2019 9:24 am
by Reinis
Hi, I'm trying to make a script that runs only if the time is between for example from 18:00:00pm to 04:00:00am hs.

So far I've got this one working:

:if ([/system clock get time] > "18:00:00") do={}

This one will run if time is past 18:00:00, but what I need now is to "tell" the script to only run if time is between 18:00:00pm to 04:00:00am

Thanks everyone.
an example would be:
:local time [/system clock get time];
:if ($time >= "18:00:00" || $time <= "04:00:00") do={ :log warning time_is_between_18_and_04 } 

Re: If time between help

Posted: Thu Jun 13, 2019 4:22 pm
by torrington
Hi, I'm trying to make a script that runs only if the time is between for example from 18:00:00pm to 04:00:00am hs.

So far I've got this one working:

:if ([/system clock get time] > "18:00:00") do={}

This one will run if time is past 18:00:00, but what I need now is to "tell" the script to only run if time is between 18:00:00pm to 04:00:00am

Thanks everyone.
an example would be:
:local time [/system clock get time];
:if ($time >= "18:00:00" || $time <= "04:00:00") do={ :log warning time_is_between_18_and_04 } 
Thank you very much. Work Great!!

Re: If time between help

Posted: Tue Feb 07, 2023 10:00 am
by vadsher
:local time [/system clock get time];
:if ($time >= "18:00:00" || $time <= "04:00:00") do={ :log warning time_is_between_18_and_04 } 
Only registered to say thanks for the ready-made code block! In my case the code looks like this:
:local time [/system clock get time];
:if ($time >= "08:30:00" || $time <= "20:30:00") do={
#Send message to Telegram
/tool fetch url="https://api.telegram.org/bot$(token)/sendMessage\?chat_id=$(id2)&text=$(msg2)" dst-path=up.txt
}