# Duration between 2 dates: days, months, years

**URL:** <https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084>\
**Category:** Ask for Help\
**Created:** [November 28, 2022, 1:51pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084 "2022-11-28T13:51:43Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [November 28, 2022, 1:51pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/1 "2022-11-28T13:51:43Z")

</div>

I have a start (3-23-20) and an end date (10-19-22). How do I make the calculation in X years, Y months, Z days? Thank in advance?

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [November 28, 2022, 2:17pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/2 "2022-11-28T14:17:45Z")

</div>

Hi there.

How precise do you need this to be? I remember Jeff sharing formulas for date calculations that were very precise. I’m offering a more approximate solution.

**The example you gave**

 ![Screenshot 2022-11-28 at 15.09.41](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/1/c1a26d41e633efcc197b683f8007f5a022e67399.png)

**The formulae I used**

 ![Screenshot 2022-11-28 at 15.12.21](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/0/2080ab00a4afa2c46a3362b59d0d0b66b4c7b7dc.png)

* * *

 ![Screenshot 2022-11-28 at 15.12.37](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/8/88d3192c134674c3db3a59abcd2bfdf13f0fcfc3.png)

* * *

 ![Screenshot 2022-11-28 at 15.13.08](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/f/2fe50d5d457447a9e758749f29c39c9718b9db9b.png)

* * *

 ![Screenshot 2022-11-28 at 15.13.30](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/1/113a712ac3b416d23ab69574122d53d0e2e37c10.png)

You can play around with the math formulae FLOOR, CEILING and ROUND to round up or down the numbers.

My formulae are approximate because you can see that when you are close to a limit, depending on what the exact dates are, you might be slightly above or slightly below a limit, which could entirely change the FLOOR or CEILING values.

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [November 28, 2022, 2:19pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/3 "2022-11-28T14:19:27Z")

</div>

It doesnt’t have to really precise. It’s about how long people keep a subscription. Months would be nice to start with. Thanks! I’ll have a look!

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [November 28, 2022, 2:54pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/4 "2022-11-28T14:54:13Z")

</div>

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [November 28, 2022, 2:55pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/5 "2022-11-28T14:55:04Z")

</div>

How do you use ROUND in a formula? Thanks again!

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [November 28, 2022, 2:59pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/6 "2022-11-28T14:59:34Z")

</div>

For DurationMonths for instance:

ROUND(DD/30.42)  
FLOOR(DD/30.42)  
CEILING(DD/30.42)

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [November 28, 2022, 3:01pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/7 "2022-11-28T15:01:09Z")

</div>

Ah thanks so much! Learned again today!

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [November 28, 2022, 4:41pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/8 "2022-11-28T16:41:51Z")

</div>

Last question. I think 😉  
When I do ROUND what is normally 8:03:14 I would expect 8 but get 1. Is there a way to get 8?

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [November 28, 2022, 4:53pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/9 "2022-11-28T16:53:02Z")

</div>

Is 8:03:14 a DateTime basic column? What happens once you pass it through a template column to change the format? Once you get a decimal number, then maybe try ROUND?

(I’m not in front of a computer 🙏)

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [November 28, 2022, 6:28pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/10 "2022-11-28T18:28:08Z")

</div>

I would do DurationDays by Math (DurationHours/24).  
You use a template for DurationDays and to get rid of the : 's. What does your template look like?  
No hurry!

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [November 29, 2022, 11:41am UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/11 "2022-11-29T11:41:22Z")

</div>

@nathanaelb You use a template for DurationDays and to get rid of the : 's. What would your template look like? Thanks!

---

<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:** [November 29, 2022, 7:40pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/12 "2022-11-29T19:40:59Z")

</div>

Use the `Date Difference` column.

 ![CleanShot 2022-11-29 at 11.43.33@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/d/0d8b9a4ea81cd64bbb21f2e4587d07e045720ed9.jpeg)

---

<div class="post-metadata">

**Author:** ![erwblo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/erwblo/32/75_2.png) [@erwblo](https://community.glideapps.com/u/erwblo)\
**Post date:** [November 29, 2022, 7:46pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/13 "2022-11-29T19:46:28Z")

</div>

Ah wow! Didn’t know about this one!  
Great!  
Thanks a lot!

cc @nathanaelb

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [November 30, 2022, 12:49pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/14 "2022-11-30T12:49:43Z")

</div>

**DurationHours**

I used a math column to determine DurationHours. The result is displayed in an hour:minutes:seconds format.

 ![Screenshot 2022-11-30 at 13.40.12](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/b/cbd61bbdc6fe71fb76759761f892b5718aa33d69.png)

**DurationDays**

I used the template column to change the format. An integer is now displayed (instead of hours:minutes:seconds) and instead of the number of hours being displayed, it is the equivalent number of days.

 ![Screenshot 2022-11-30 at 13.43.33](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/8/c84b588594a4cec2dfb62c8a1925645638f5fd5d.png)

With the number of days as an integer and math columns, you can then determine number of hours, weeks, months, years.

---

<div class="post-metadata">

**Author:** ![NFNHello](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nfnhello/32/3371_2.png) [@NFNHello](https://community.glideapps.com/u/NFNHello)\
**Post date:** [November 30, 2022, 4:14pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/15 "2022-11-30T16:14:46Z")

</div>

Now wait here just a darn second… when did this arrive?! I’m excited to see how it handles leap years!

---

<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:** [December 1, 2022, 4:15pm UTC](https://community.glideapps.com/t/duration-between-2-dates-days-months-years/55084/16 "2022-12-01T16:15:11Z")

</div>

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