22.04.2020, 11:12
(22.04.2020, 10:30)benanderson_475 Wrote:(22.04.2020, 10:19)camillsg Wrote: Hi!
I want to check if the local time is "greater" than a specific time, regardless of date.
As an example I want to check if the clock is more than 19 o'clock.
Is there a simple way to do this? Maybe with just two lines of scripting?
I understand that os.time(os.date('*t')) returns local time as the number of seconds from Thursday, 1 January 1970.
And os.time({year=2001, month=9, day=11, hour=13, minute=46}) returns also the number of seconds from Thursday, 1 January 1970.
But what I really want is os.time({hour=13, minute=46}), which I do not think is possible to write.
And I want to see if this time is before or later the local time os.date('*t'), but just hour and minutes.
Thanks for all your help!!
Kind regards,
Camilla
you can do it like this
Code:local t = os.date("*t")
if t.hour == 13 and t.min == 46 then
--do something
end
-- if hour is greater than or equal to 13.00
if t.hour >=13 then
--do something else
end
Thank you so much!!