# If Condition, Time is between

**URL:** https://community.glideapps.com/t/if-condition-time-is-between/57291
**Category:** Ask for Help
**Created:** [January 31, 2023, 5:31am UTC](https://community.glideapps.com/t/if-condition-time-is-between/57291 "2023-01-31T05:31:24Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Jireh\_Lee](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jireh_lee/32/52727_2.png) [@Jireh\_Lee](https://community.glideapps.com/u/Jireh_Lee)
#### Post date: [January 31, 2023, 5:31am UTC](https://community.glideapps.com/t/if-condition-time-is-between/57291/1 "2023-01-31T05:31:25Z")

</div>

Hi there, can someone educate me on how I should use the If condition function for if Time is between 2 times. How do I define the start and end time on the columns?

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: [January 31, 2023, 5:34am UTC](https://community.glideapps.com/t/if-condition-time-is-between/57291/3 "2023-01-31T05:34:48Z")

</div>

The general approach is:

- If time is before start time, then null (leave empty)
- If time is after end time, then null
- Else true

That may need to be adjusted slightly based on individual use case.

You would normally use date/time picker components to capture start/end date/time, and write those to user specific columns. Then use single value columns to apply those values to all rows in your data table, and then apply the above if-then-else logic.

---

<div class="post-metadata">

### Author: ![Jireh\_Lee](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jireh_lee/32/52727_2.png) [@Jireh\_Lee](https://community.glideapps.com/u/Jireh_Lee)
#### Post date: [January 31, 2023, 5:41am UTC](https://community.glideapps.com/t/if-condition-time-is-between/57291/4 "2023-01-31T05:41:26Z")

</div>

Oh i mean there is an option available in the If Condition but I have no idea how to use it.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/4/24b273ba564cde29a3596b85d2dbe0a4aa9bf4ef.png)

Can it be within 2 predefined times or can it only use the value “today”?

---

<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: [January 31, 2023, 5:47am UTC](https://community.glideapps.com/t/if-condition-time-is-between/57291/5 "2023-01-31T05:47:23Z")

</div>

If you want predefined dates and/or times other than today/now, then you’ll have to define those separately using math columns.

For example, let say you want a start date of 24 hours ago, then you could create a math column using `Now -1`, and then reference that column in your if-then-else column.

---

<div class="post-metadata">

### Author: ![Jireh\_Lee](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jireh_lee/32/52727_2.png) [@Jireh\_Lee](https://community.glideapps.com/u/Jireh_Lee)
#### Post date: [January 31, 2023, 5:51am UTC](https://community.glideapps.com/t/if-condition-time-is-between/57291/6 "2023-01-31T05:51:39Z")

</div>

Ok. So it has to be within a 24 hour window and not 2 predefined times like 2 dates?

---

<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: [January 31, 2023, 5:52am UTC](https://community.glideapps.com/t/if-condition-time-is-between/57291/7 "2023-01-31T05:52:11Z")

</div>

It can be anything you like.

Can you give me a specific example of what you need?

---

<div class="post-metadata">

### Author: ![Jireh\_Lee](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jireh_lee/32/52727_2.png) [@Jireh\_Lee](https://community.glideapps.com/u/Jireh_Lee)
#### Post date: [January 31, 2023, 5:54am UTC](https://community.glideapps.com/t/if-condition-time-is-between/57291/8 "2023-01-31T05:54:57Z")

</div>

So i have a column with a timestamp in each row. And I want to create a If condition column to say IF “time\_column” is within “9:30AM to 12:00PM” then “Earlybird”.

---

<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: [January 31, 2023, 5:57am UTC](https://community.glideapps.com/t/if-condition-time-is-between/57291/9 "2023-01-31T05:57:26Z")

</div>

Okay, cool.

For this, you can use a math column with the formula `Hour(Date)`  
This will give you a number representing the hour of the day from the date/time.

Then you can do something like:

- If Hour is less than 9.5, then null
- If Hour is greater than 12, then null
- Else “Earlybird”

---

<div class="post-metadata">

### Author: ![Jireh\_Lee](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jireh_lee/32/52727_2.png) [@Jireh\_Lee](https://community.glideapps.com/u/Jireh_Lee)
#### Post date: [January 31, 2023, 6:07am UTC](https://community.glideapps.com/t/if-condition-time-is-between/57291/10 "2023-01-31T06:07:31Z")

</div>

Thank you for that!

---

<div class="post-metadata">

### Author: ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)
#### Post date: [February 1, 2023, 6:07am UTC](https://community.glideapps.com/t/if-condition-time-is-between/57291/11 "2023-02-01T06:07:37Z")

</div>

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