# Time period

**URL:** https://community.glideapps.com/t/time-period/23936
**Category:** Ask for Help
**Created:** [March 8, 2021, 5:31am UTC](https://community.glideapps.com/t/time-period/23936 "2021-03-08T05:31:39Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Antonoff](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/antonoff/32/22045_2.png) [@Antonoff](https://community.glideapps.com/u/Antonoff)
#### Post date: [March 8, 2021, 5:31am UTC](https://community.glideapps.com/t/time-period/23936/1 "2021-03-08T05:31:39Z")

</div>

Hi there!

There is an interesting task: to compare time periods.

Scenario: there are two tables, both of which indicate the validity period of the promo code. The period is expressed as a start and end date. Tables are linked by relations that track changes in rows. The problem is that if the date is stored not as a number, but as a date, then months cannot be compared.

How can you compare dates and show the results to the user with a spread of + or - 2 days?

I only see a solution if the date and the first table is split into separate cells and stored as a number.

What solution do you see?

---

<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: [March 8, 2021, 5:44am UTC](https://community.glideapps.com/t/time-period/23936/2 "2021-03-08T05:44:47Z")

</div>

You should be able to do this using the available date math functions in Glide, but it’s not clear to me exactly what your comparison criteria are. Are you just trying to determine if the two time periods overlap? Or something else?

---

<div class="post-metadata">

### Author: ![Antonoff](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/antonoff/32/22045_2.png) [@Antonoff](https://community.glideapps.com/u/Antonoff)
#### Post date: [March 8, 2021, 5:50am UTC](https://community.glideapps.com/t/time-period/23936/3 "2021-03-08T05:50:29Z")

</div>

> [@Darren\_Murphy](#):
>
> Are you just trying to determine if the two time periods overlap?

Yes it is

---

<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: [March 8, 2021, 6:02am UTC](https://community.glideapps.com/t/time-period/23936/4 "2021-03-08T06:02:25Z")

</div>

Can you show some sample data, please? (with expected results based on that data).  
I just want to be sure that I understand the problem correctly, before I suggest a solution.

---

<div class="post-metadata">

### Author: ![Antonoff](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/antonoff/32/22045_2.png) [@Antonoff](https://community.glideapps.com/u/Antonoff)
#### Post date: [March 8, 2021, 6:13am UTC](https://community.glideapps.com/t/time-period/23936/5 "2021-03-08T06:13:25Z")

</div>

For example, the promo code is valid from 2.02.20 to 28.03.20. User set the time range for the promotional code from March to April. As a result, the user should see this promo code plus promotional codes for April.

---

<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: [March 8, 2021, 6:25am UTC](https://community.glideapps.com/t/time-period/23936/6 "2021-03-08T06:25:48Z")

</div>

~~If the user should see promo codes for April, is the given end date (28 March) even important?  
Could I restate that as:~~

~~
- Given a Start Date, show me any codes that are valid as of that date or any time in the future

~~

~~??~~

Sorry, I misread… let me digest that a bit more and give a better response…

---

<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: [March 8, 2021, 6:31am UTC](https://community.glideapps.com/t/time-period/23936/7 "2021-03-08T06:31:04Z")

</div>

> [@Antonoff](#):
>
> For example, the promo code is valid from 2.02.20 to 28.03.20. User set the time range for the promotional code from March to April. As a result, the user should see this promo code plus promotional codes for April.

Okay, how about this:

 ![Screen Shot 2021-03-08 at 2.30.24 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/2/82de1891f419dcc10305bc2bc1ae5630b2cb307f.png)

---

<div class="post-metadata">

### Author: ![Antonoff](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/antonoff/32/22045_2.png) [@Antonoff](https://community.glideapps.com/u/Antonoff)
#### Post date: [March 8, 2021, 7:04pm UTC](https://community.glideapps.com/t/time-period/23936/8 "2021-03-08T19:04:00Z")

</div>

It’s brilliant!  
Such a simple and working solution!  
Big thanks!

---

<div class="post-metadata">

### Author: ![Antonoff](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/antonoff/32/22045_2.png) [@Antonoff](https://community.glideapps.com/u/Antonoff)
#### Post date: [March 9, 2021, 6:48am UTC](https://community.glideapps.com/t/time-period/23936/9 "2021-03-09T06:48:17Z")

</div>

Now I ran into another problem: what to do if the data is on different sheets? I did it through Arrowformula, but then the values are in different cells, that is, they cannot be copied, and the ultimate goal is to copy the desired string into the third table.

---

<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: [March 9, 2021, 6:53am UTC](https://community.glideapps.com/t/time-period/23936/10 "2021-03-09T06:53:15Z")

</div>

The usual way to do this is to create a relation between the two tables, using a column that is common to both. You can then use Lookup columns to bring the values across from one sheet to the other.

If you can provide a screenshot of what each table looks like in the Glide Data Editor, I can probably offer some more specific advice.

---

<div class="post-metadata">

### Author: ![Antonoff](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/antonoff/32/22045_2.png) [@Antonoff](https://community.glideapps.com/u/Antonoff)
#### Post date: [March 9, 2021, 6:57am UTC](https://community.glideapps.com/t/time-period/23936/11 "2021-03-09T06:57:50Z")

</div>

Can i add you in team so you can see the 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: [March 9, 2021, 6:59am UTC](https://community.glideapps.com/t/time-period/23936/12 "2021-03-09T06:59:46Z")

</div>

Yes, okay. I’ll PM you my email address.

---

<div class="post-metadata">

### Author: ![NoCodeAndy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nocodeandy/32/62530_2.png) [@NoCodeAndy](https://community.glideapps.com/u/NoCodeAndy)
#### Post date: [January 17, 2024, 4:53pm UTC](https://community.glideapps.com/t/time-period/23936/13 "2024-01-17T16:53:01Z")

</div>


