# Comparing time

**URL:** <https://community.glideapps.com/t/comparing-time/48537>\
**Category:** Ask for Help\
**Created:** [September 4, 2022, 5:43am UTC](https://community.glideapps.com/t/comparing-time/48537 "2022-09-04T05:43:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ovi](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@Ovi](https://community.glideapps.com/u/Ovi)\
**Post date:** [September 4, 2022, 5:43am UTC](https://community.glideapps.com/t/comparing-time/48537/1 "2022-09-04T05:43:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 4, 2022, 6:41am UTC](https://community.glideapps.com/t/comparing-time/48537/2 "2022-09-04T06:41:52Z")

</div>

- 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

---

<div class="post-metadata">

**Author:** ![Ovi](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@Ovi](https://community.glideapps.com/u/Ovi)\
**Post date:** [September 4, 2022, 6:53am UTC](https://community.glideapps.com/t/comparing-time/48537/3 "2022-09-04T06:53:50Z")

</div>

Hour(date) is in glide tables ?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 4, 2022, 6:54am UTC](https://community.glideapps.com/t/comparing-time/48537/4 "2022-09-04T06:54:47Z")

</div>

Yes, using a math column.

---

<div class="post-metadata">

**Author:** ![Ovi](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@Ovi](https://community.glideapps.com/u/Ovi)\
**Post date:** [September 4, 2022, 9:19am UTC](https://community.glideapps.com/t/comparing-time/48537/5 "2022-09-04T09:19:07Z")

</div>

> [@Darren\_Murphy](#):
>
> 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

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

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 4, 2022, 9:21am UTC](https://community.glideapps.com/t/comparing-time/48537/6 "2022-09-04T09:21:05Z")

</div>

Can I see a screen shot of the columns please?

---

<div class="post-metadata">

**Author:** ![Ovi](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@Ovi](https://community.glideapps.com/u/Ovi)\
**Post date:** [September 4, 2022, 9:28am UTC](https://community.glideapps.com/t/comparing-time/48537/7 "2022-09-04T09:28:38Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/d/9d87e2232ef3093089e2d192a5e3863fd3c75bbd.jpeg)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/2/8297682b844abfc810e6db88222ca3a040a1bcc2.jpeg)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 4, 2022, 9:32am UTC](https://community.glideapps.com/t/comparing-time/48537/8 "2022-09-04T09:32:20Z")

</div>

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.
