# Get sequence of dates

**URL:** https://community.glideapps.com/t/get-sequence-of-dates/67160
**Category:** Ask for Help
**Tags:** tutorial
**Created:** [October 20, 2023, 7:27pm UTC](https://community.glideapps.com/t/get-sequence-of-dates/67160 "2023-10-20T19:27:49Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![xaviigna](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/xaviigna/32/29090_2.png) [@xaviigna](https://community.glideapps.com/u/xaviigna)
#### Post date: [October 20, 2023, 7:27pm UTC](https://community.glideapps.com/t/get-sequence-of-dates/67160/1 "2023-10-20T19:27:49Z")

</div>

![Captura de Pantalla 2023-10-20 a la(s) 13.25.19](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/f/2f637a289c8b875483ff7418be336d7bd0c2d3d7.png)

How can I get the sequence between dates on glideapps? I tried with JavaScript code snippet and Excel formulas but did not work.

Could you please help me?

Best,  
Xavier

---

<div class="post-metadata">

### Author: ![david](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/david/32/62831_2.png) [@david](https://community.glideapps.com/u/david)
#### Post date: [October 20, 2023, 8:19pm UTC](https://community.glideapps.com/t/get-sequence-of-dates/67160/2 "2023-10-20T20:19:33Z")

</div>

What is the sequence between dates? A list of all the dates between?

---

<div class="post-metadata">

### Author: ![xaviigna](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/xaviigna/32/29090_2.png) [@xaviigna](https://community.glideapps.com/u/xaviigna)
#### Post date: [October 20, 2023, 8:36pm UTC](https://community.glideapps.com/t/get-sequence-of-dates/67160/3 "2023-10-20T20:36:46Z")

</div>

Exactly, I just need the sequence of dates between Initial and last value.

12/10/2023  
13/10/2023  
14/10/2023…… and so on

---

<div class="post-metadata">

### Author: ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)
#### Post date: [October 20, 2023, 8:46pm UTC](https://community.glideapps.com/t/get-sequence-of-dates/67160/4 "2023-10-20T20:46:03Z")

</div>

Do you need the dates on their own row?

---

<div class="post-metadata">

### Author: ![xaviigna](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/xaviigna/32/29090_2.png) [@xaviigna](https://community.glideapps.com/u/xaviigna)
#### Post date: [October 20, 2023, 9:06pm UTC](https://community.glideapps.com/t/get-sequence-of-dates/67160/5 "2023-10-20T21:06:48Z")

</div>

Not necessary, could be on another row

---

<div class="post-metadata">

### Author: ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)
#### Post date: [October 20, 2023, 10:29pm UTC](https://community.glideapps.com/t/get-sequence-of-dates/67160/6 "2023-10-20T22:29:00Z")

</div>

I mean, do you need

Date 1  
Date 2  
Date 3

Or can it be  
Date 1, Date 2, Date 3 … ?

---

<div class="post-metadata">

### Author: ![xaviigna](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/xaviigna/32/29090_2.png) [@xaviigna](https://community.glideapps.com/u/xaviigna)
#### Post date: [October 20, 2023, 11:01pm UTC](https://community.glideapps.com/t/get-sequence-of-dates/67160/7 "2023-10-20T23:01:38Z")

</div>

Could it be Date 1, Date 2… etc

Any ideas?

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [October 21, 2023, 12:57am UTC](https://community.glideapps.com/t/get-sequence-of-dates/67160/8 "2023-10-21T00:57:50Z")

</div>

May we know what’s your use case for this? Are you using it for creating relations down the road?

---

<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: [October 21, 2023, 4:35am UTC](https://community.glideapps.com/t/get-sequence-of-dates/67160/9 "2023-10-21T04:35:46Z")

</div>

Using JavaScript:

```auto
const startDate = new Date(p1);
const endDate = new Date(p2);
const dates = [];
let currentDate = new Date(startDate);
while (currentDate <= endDate) {
  dates.push(new Date(currentDate));
  currentDate.setDate(currentDate.getDate() + 1);
}
return dates.join(',');

```

But I suspect that’s probably not what you want.  
As @ThinhDinh mentioned, it would be useful if you told us how you plan to use this. We might then be able to suggest an appropriate solution for your use case.

---

<div class="post-metadata">

### Author: ![xaviigna](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/xaviigna/32/29090_2.png) [@xaviigna](https://community.glideapps.com/u/xaviigna)
#### Post date: [October 21, 2023, 5:29am UTC](https://community.glideapps.com/t/get-sequence-of-dates/67160/10 "2023-10-21T05:29:39Z")

</div>

I am trying to get the sequence between Initial and Last day because those days are the ones the business pays because it does daily, What I am triying to figure out is the day the business did not pay by making a function and create a ListRelation from the day in charge and the sequence.

For example

Initial payment: 20/10/2023  
Last payment: 30/10/2023

the sequence should be: 20/10/2023, 21/10/2023, 22/10/2023…30/10/2023

DatePayment1: 20/10/2023  
DatePayment1: 21/10/2023  
DatePayment1: DID NOT PAY

I want to build a list relationship and filtering them by days appeared in the sequence and if not, it should give me a count of the days that didn’t pay. I know how to do that, I just want to figure out the sequence from initial and Last dates.

Does that make sense?

---

<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: [October 21, 2023, 11:59am UTC](https://community.glideapps.com/t/get-sequence-of-dates/67160/11 "2023-10-21T11:59:19Z")

</div>

Okay.

If your only goal is to get a count of days where payment wasn’t made, then all you need to do is use a math column to count the number of days between the Start Date and the End Date (eg. `Trunc(End-Start)`), and then compare that to the number of payments made.

If you want something that can be displayed as a List - eg. one item for each payment date - then my recommendation would be to use a Helper Table to dynamically generate the list. Essentially you’d set the Start and End Dates in two user specific columns, apply those to all rows with Single Value columns, use a Row Index plus Math column (`Date + Index`) to generate a list of Dates between the two, and then use that to build a relation back to your Payments table. Any row where the relation is empty would represent a missed payment date.

You would just need to ensure you have enough rows in the Helper table to cover the maximum payment period.
