# Comparing time

How can I compare time columns?

Let’s use the case in which we can check if the current hour is in a time schedule.

In one column we would have the current hour and in 2 others we would have the opening and closing times … How can I check if the current hour is between those 2 ?

Thanks.

• Convert each of the open and close times to an integer representing the hour of the day, using `Hour(Date)`
• Do the same with the current date/time (Now)
• Now you can do a simple numerical comparison with an if-then-else column:
– If Now hour is less than opening hour, then Closed
– If Now hour is greater than closing hour, then Closed
– Else Open
1 Like

Hour(date) is in glide tables ?

Yes, using a math column.

I can’t select in if-then-else column less or greater when I have a math column … any suggestions ?

Can I see a screen shot of the columns please?

There is obviously something wrong with your Math columns.
`Hour(Date)` will always return a number between 0 and 23.
The numbers you have indicate that either your formulas are wrong, or the value you are using as a replacement is not a date/time.

1 Like