# 🆕 Date-time Math

**URL:** <https://community.glideapps.com/t/date-time-math/15963>\
**Category:** General\
**Tags:** data-editor\
**Created:** [September 17, 2020, 5:47pm UTC](https://community.glideapps.com/t/date-time-math/15963 "2020-09-17T17:47:41Z")\
**Posts on this page:** 20\
**Page:** 5

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [January 16, 2021, 1:44am UTC](https://community.glideapps.com/t/date-time-math/15963/83 "2021-01-16T01:44:26Z")

</div>

ok, i fixed formula to:  
floor((((now - time in)\*24)-floor(((now - time in)\*24)))\*60)  
and is working good now, tnx for helping

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [January 16, 2021, 6:32am UTC](https://community.glideapps.com/t/date-time-math/15963/84 "2021-01-16T06:32:25Z")

</div>

so i created nice tab “Time Card” using math column and Now function

> **[E-store](https://e-strore.glideapp.io/)**
>
> Online bidding App

---

<div class="post-metadata">

**Author:** ![Daniel\_Canup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_canup/32/32850_2.png) [@Daniel\_Canup](https://community.glideapps.com/u/Daniel_Canup)\
**Post date:** [March 16, 2021, 4:50pm UTC](https://community.glideapps.com/t/date-time-math/15963/85 "2021-03-16T16:50:17Z")

</div>

Hey guys how would I be able to display X number of hours and X number of minutes? (1hr & 5 minutes)

See screenshot…

[![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/3/531bec59df2b20d422fdf589f99a130984e80f75.png) ](https://dl.dropboxusercontent.com/s/42mflhyoh67wfxe/Screen%20Shot%202021-03-16%20at%2010.47.45%20AM.png?dl=0)

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [March 16, 2021, 5:00pm UTC](https://community.glideapps.com/t/date-time-math/15963/86 "2021-03-16T17:00:33Z")

</div>

> [@Time duration not presenting correctly in glide chart stopwatch](https://community.glideapps.com/t/time-duration-not-presenting-correctly-in-glide-chart/24014/6):
>
> I took it a step further and included Days as well. You can exclude it if you don’t need it. It’s a little involved, but I’ll explain the best I can. Here is my results: First we have the Duration column, which is obvious and what you already have. Next we have the Days column: FLOOR(D)/100 This is simply taking the duration and dropping off the decimals. The division by 100 will be explained later. Next we have the Hours column: FLOOR(MOD(D,1)\*24)/100 Th…

---

<div class="post-metadata">

**Author:** ![Daniel\_Canup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_canup/32/32850_2.png) [@Daniel\_Canup](https://community.glideapps.com/u/Daniel_Canup)\
**Post date:** [March 16, 2021, 5:17pm UTC](https://community.glideapps.com/t/date-time-math/15963/87 "2021-03-16T17:17:26Z")

</div>

Thank-you @Jeff_Hager…so now the final question is…  
Why is the minute column doing what it is? It should be 5 minutes…?

[![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/5/f541faa25762d575532e9b3b9e204e16ee9e5562.png) ](https://dl.dropboxusercontent.com/s/zb42athlpde3qmd/Screen%20Shot%202021-03-16%20at%2011.16.17%20AM.png?dl=0)

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [March 16, 2021, 5:21pm UTC](https://community.glideapps.com/t/date-time-math/15963/88 "2021-03-16T17:21:31Z")

</div>

Can you show the formula in your minutes column?

---

<div class="post-metadata">

**Author:** ![Daniel\_Canup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_canup/32/32850_2.png) [@Daniel\_Canup](https://community.glideapps.com/u/Daniel_Canup)\
**Post date:** [March 16, 2021, 5:22pm UTC](https://community.glideapps.com/t/date-time-math/15963/89 "2021-03-16T17:22:28Z")

</div>

I used yours form the example…which would you care to see?

---

<div class="post-metadata">

**Author:** ![Daniel\_Canup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_canup/32/32850_2.png) [@Daniel\_Canup](https://community.glideapps.com/u/Daniel_Canup)\
**Post date:** [March 16, 2021, 5:23pm UTC](https://community.glideapps.com/t/date-time-math/15963/90 "2021-03-16T17:23:06Z")

</div>

[![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/8/1885a33c40e1b2018ee83f62576739dfdfb40aa7.png) ](https://dl.dropboxusercontent.com/s/nwngywtfwebxcya/Screen%20Shot%202021-03-16%20at%2011.22.55%20AM.png?dl=0)

---

<div class="post-metadata">

**Author:** ![Daniel\_Canup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_canup/32/32850_2.png) [@Daniel\_Canup](https://community.glideapps.com/u/Daniel_Canup)\
**Post date:** [March 16, 2021, 6:27pm UTC](https://community.glideapps.com/t/date-time-math/15963/91 "2021-03-16T18:27:15Z")

</div>

Hey, @Jeff_Hager did that help?

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [March 16, 2021, 7:36pm UTC](https://community.glideapps.com/t/date-time-math/15963/92 "2021-03-16T19:36:43Z")

</div>

Sorry, had to deal with my paying day job.

I was hoping to see the Minutes column, not the duration column, but seeing that does help and I’m assuming you are using the same formula from my other post in the minutes column, I think you may have a problem because you are multiplying you duration by 24. The duration should be the difference between the two date columns with no other math applied. My formulas deal with the raw duration that based on the fact that 1.0 equals 1 day. Multiplying by 24 is throwing it out of whack.

Your duration for 1 hour 5 minutes should be approximately 0.045. Also, my formulas deal with seconds, so if you use the existing formulas, you may end up with slightly different results than you are thinking. For example, your calculated duration of 1.08 divided by 24 is 0.045. 0.045 is equal to 1 hour, 4 minutes and 47 seconds. If you want it to always round up to the next minute, then you may have to change the FLOOR in the Minutes column to a CEILING. Or you may have to change it to a ROUND if you want it to round either up or down. This is assuming that you don’t want to see seconds at all.

Hope that helps.

---

<div class="post-metadata">

**Author:** ![Daniel\_Canup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_canup/32/32850_2.png) [@Daniel\_Canup](https://community.glideapps.com/u/Daniel_Canup)\
**Post date:** [March 16, 2021, 7:41pm UTC](https://community.glideapps.com/t/date-time-math/15963/93 "2021-03-16T19:41:25Z")

</div>

[![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/7/c745a3b76a26716b022067335b582ecffc0b0e1e.png) ](https://dl.dropboxusercontent.com/s/oa4p1dcak18qf1q/Screen%20Shot%202021-03-16%20at%201.41.14%20PM.png?dl=0)

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [March 16, 2021, 7:47pm UTC](https://community.glideapps.com/t/date-time-math/15963/94 "2021-03-16T19:47:54Z")

</div>

Ok, that looks fine. Just fix the duration column and you should be good.

Just remember that in the current form, it will always round the minutes down. It’s up to you how you want the minutes to round based on the number of seconds beyond a minute.

---

<div class="post-metadata">

**Author:** ![Daniel\_Canup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_canup/32/32850_2.png) [@Daniel\_Canup](https://community.glideapps.com/u/Daniel_Canup)\
**Post date:** [March 16, 2021, 7:56pm UTC](https://community.glideapps.com/t/date-time-math/15963/95 "2021-03-16T19:56:03Z")

</div>

Okay so I changed things to CEILING but It is 2 minutes off still. I am sorry man, I stink at math.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [March 16, 2021, 8:06pm UTC](https://community.glideapps.com/t/date-time-math/15963/96 "2021-03-16T20:06:12Z")

</div>

Can you show the work? It works for me. I want to see the values in your duration, hour, and minute columns, as well as the formulas in each of them.

---

<div class="post-metadata">

**Author:** ![Daniel\_Canup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_canup/32/32850_2.png) [@Daniel\_Canup](https://community.glideapps.com/u/Daniel_Canup)\
**Post date:** [March 16, 2021, 8:09pm UTC](https://community.glideapps.com/t/date-time-math/15963/97 "2021-03-16T20:09:22Z")

</div>

https://player.vimeo.com/video/524485125

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [March 16, 2021, 8:14pm UTC](https://community.glideapps.com/t/date-time-math/15963/98 "2021-03-16T20:14:37Z")

</div>

- Remove the divide by 24 in the duration column. There should be no manipulation to the duration other than the subtraction of start time from end time.

- Change CEILING back to FLOOR in the hour column. You don’t need to change that one because you have a minutes column to handle the fractions of an hour. Only the minutes column should have a CEILING because you don’t have a seconds column to handle the fractions of a second.

---

<div class="post-metadata">

**Author:** ![Daniel\_Canup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_canup/32/32850_2.png) [@Daniel\_Canup](https://community.glideapps.com/u/Daniel_Canup)\
**Post date:** [March 16, 2021, 8:17pm UTC](https://community.glideapps.com/t/date-time-math/15963/99 "2021-03-16T20:17:35Z")

</div>

Dude!!! You are truly amazing!!!

That was it 🙂  
Thank-you so so much!

---

<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 17, 2021, 12:37pm UTC](https://community.glideapps.com/t/date-time-math/15963/100 "2021-03-17T12:37:01Z")

</div>

I know you already have a solution from @Jeff_Hager, but thought I’d just chip in show you how I do this (this is something I actually do quite often).

 ![Screen Shot 2021-03-17 at 8.29.14 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/1/f1aaff9d6d3d056f7c587507a7686876d84bdc4f.png)

Running through the columns from left to right:

- `mth-duration-mins`: calculates the duration in minutes. `(end-start)*1440`
- `mth-whole-hours`: calculates the whole number of hours from the previous column. `FLOOR(dur/60)`
- `mth-minutes`: calculates the “remaining” minutes component of the duration. `MOD(dur,60)`
- `ite-hrhrs` & `ite-minmins`: two if-then-else columns that provide correct pluralisation.
- `tp-duration`: template column that provides the final result.

NB. The `mth-duration-mins` is a bit redundant, but I generally keep it to make the whole sequence a bit easier to follow.

---

<div class="post-metadata">

**Author:** ![Daniel\_Canup](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/daniel_canup/32/32850_2.png) [@Daniel\_Canup](https://community.glideapps.com/u/Daniel_Canup)\
**Post date:** [March 17, 2021, 1:08pm UTC](https://community.glideapps.com/t/date-time-math/15963/101 "2021-03-17T13:08:17Z")

</div>

This is a simple approach too.

What do your if columns look like?

---

<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 17, 2021, 1:09pm UTC](https://community.glideapps.com/t/date-time-math/15963/102 "2021-03-17T13:09:38Z")

</div>

![Screen Shot 2021-03-17 at 9.08.48 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/8/f8b355c7de52d58438dbe301144eaaee274956b8.png)

The one for min/mins is basically identical.

[Previous page](https://community.glideapps.com/t/date-time-math/15963.md?page=4)

[Next page](https://community.glideapps.com/t/date-time-math/15963.md?page=6)
