How to disable the button between a few hours and a few minutes

Hello friends! I need your help! I want to make a button or arrangement only visible between 06:25 am and 07:10 am, how can I do this? and that shows the time that is available! Thank you so much! Regards! :heart_eyes:

You can get time online with this extension(or others)

And when screen intialize check time. If time is not between 6:25 and 7:10 then set visible false, else true

2 Likes

I think for this he have to convert the time to millis and then check if if the time is in between 6:25 and 7:10 or use this extension:

1 Like

Yes he have to convert

2 Likes

Welcome !
You need an If to check if the current value (hour and minutes is greater than or equal to 6:30 and less than 7:10), if it is, set Visible = true and start the time counter.

1 Like

The problem is that if the time value is not exactly the same, the condition is not satisfied.
That’s why we should use major and minor operators to establish a range of schedules.

I would do something like that:

In the marked blocks you set the hours between which you want to activate or deactivate the button.

Now it’s set from 15:00 to 15:08. When it goes past 15:08 it is deactivated.

EDIT: The first label it´s only to see the current time.

3 Likes

Like that …

2 Likes

You have to do as he said

And check greater than/greater than or equal to / less than / less than or equal to

Suppose the time you want to show that button is between 20000 Ms and 50000 Ms
Then check if greater than or equal to 20000 and less than or equal to 50000

Then show button
Else not

:blush:

2 Likes

Or something like this:

2 Likes

Thank you dear friend for your contribution! It is also welcome! wow! Thank you!

thank you! for your Solution! It is effective! :heart_eyes:

Thank you! Friend! regards!

Thank you so much! Friend! for Your Great Help! Direct! One more question! How could I store the hours in a Tiny BD so that the user cannot change the time of his device and the button can be visible, or some other solution? Thank you dear friend! :heart_eyes: :point_right:

The marked millisecond blocks in my example should be saved in tinyDb. With different tags. Time1 with the start time and Time2 with the end time, for example. And then you should use some api that returns the current time (http://worldclockapi.com/ ) Put it in the screen initialization and check that the milliseconds in TinyDb are greater than the received from the api. That is, adapt the blocks of the image to your data sources (api and TinyDb)

pepocero Thank you very much! Friend, but how could it be possible! with the example you gave me! Regards! Thanks for your great help! you are a genious! :heart_eyes: :smiley: :raised_hands:t2:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.