is there a way to compare time values in scripts.
Say is the current time greater than 17:00:00.
I tried this.
:if ([/system clock get time] > “17:00:00”) do={}
but is always returns false.
Thanks for any help.
is there a way to compare time values in scripts.
Say is the current time greater than 17:00:00.
I tried this.
:if ([/system clock get time] > “17:00:00”) do={}
but is always returns false.
Thanks for any help.
Try this one (routerOS v 2.9):
:set hours [:tonum [:pick[/system clock get time]0 2]]
:set min [:tonum [:pick[/system clock get time]3 5]]
:set sec [:tonum [:pick[/system clock get time]6 8]]
:set a ($hours*3600 + $min*60 + $sec)
:set b 61200
:if ($a>=$b) do={}
:if ($a<$b) do={}
where 61200 is time in seconds (17:00:00). Maybe not the shortest way but atleast works for me ![]()
I really only needed to see if it was after 5 or not so I just used this line.
:if ([:pick [/system clock get time] 0 2] >= 17) do={}
Thanks for your help.