# Using "if-then-else" for visibility

Hey fellow Gliders,

I am not sure whether there is something wrong with my logic or what but I am losing my mind over this.

I have a “Now” column with gives the current time.
I have a button that I want to hide based on the time interval for example I want the button to show between 08:00 - 08:30.
I have 2 column with 08:00 as opening time and 08:30 as closing time.
Now the logic I went for is the following:

If “Now” is before 08:00 = false
If “Now” is after 08:30 = false
Else = true

The expected behaviour is that the column will be checked to show true when the time is 08:00 - 08:30 and this will result in the button being visible since I have the condition on the button to show when “if-then-else” column is checked.
What am I missing here?

What is the whole date for your time columns? You are comparing to NOW. which is a date and time

1 Like

So even if I chose the column to show “time only”? You can’t just relate it to time?

• Create a Math column using the following:
``````Hour(Now)+(Minute(Now)/60)
``````
• Now, for your if-then-else column, use:
– If math column is less than 8, then null
– If math column is greater than 8.5, then null
– Else `true`
2 Likes

Let me try this one. Thanks Darren…
Will this work regardless of the date?

Yes. It will be true for 30 minutes every day, between 8am and 8:30am.

1 Like

Thanks. Let me get to it.

Yep… it is a full date… you need to extract just time, as @Darren_Murphy shows you. Keep in mind that other users might be in a different time zone… then Darren’s method might not be good for you you can convert your time zone to the user’s time… then extract just time

1 Like

Thanks @Uzo, I am on it already.
I learn something new everyday with Glide.

1 Like

I think there must be a bug or something then because its not giving me the result i expect. The if then else column is showing “false” even though i can see it for myself that the value in “now” is within the parameters. This is supposed to be true for 12:00 and 12:30

“Now” Column construction:

If then else column construction:

`>!` wrong

1 Like

The problem is below:

That should be greater than, not less than.
Also, it’s not necessary to explicitly return false for the first two conditions. You could just leave those empty.

1 Like

…Okay…that’s it, I am taking a walk. I have been at this for a while now. It’s break time…

Thank you so much @Darren_Murphy and @Uzo for chipping in…
I am sorted now

1 Like

This method saves me columns. I don’t have to have a column for “start time” and “closing time” and therefore this is less labour intensive.
Thanks once more Darren. I wish I had asked for help sooner

1 Like

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