# 🆕 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:** 4

<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:** [September 22, 2020, 1:54am UTC](https://community.glideapps.com/t/date-time-math/15963/63 "2020-09-22T01:54:48Z")

</div>

Or maybe a template column to duplicate.

---

<div class="post-metadata">

**Author:** ![Mariano\_Betta](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mariano_betta/32/17895_2.png) [@Mariano\_Betta](https://community.glideapps.com/u/Mariano_Betta)\
**Post date:** [September 22, 2020, 10:13am UTC](https://community.glideapps.com/t/date-time-math/15963/64 "2020-09-22T10:13:25Z")

</div>

I thought I could increase in whole numbers by the difference of days, but I couldn’t.

---

<div class="post-metadata">

**Author:** ![Mariano\_Betta](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mariano_betta/32/17895_2.png) [@Mariano\_Betta](https://community.glideapps.com/u/Mariano_Betta)\
**Post date:** [September 22, 2020, 10:15am UTC](https://community.glideapps.com/t/date-time-math/15963/65 "2020-09-22T10:15:40Z")

</div>

I tried to make a template with the result and but also couldn’t use that template as an increment.  
Anyway, what I need is not so important. It can be replaced on the sheet. I just wanted to take advantage of doing the calculations on the glide data.

---

<div class="post-metadata">

**Author:** ![wjcv06](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/wjcv06/32/12747_2.png) [@wjcv06](https://community.glideapps.com/u/wjcv06)\
**Post date:** [October 8, 2020, 6:01pm UTC](https://community.glideapps.com/t/date-time-math/15963/66 "2020-10-08T18:01:58Z")

</div>

If I need substract hours, minutes, seconds?

---

<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 8, 2020, 8:14pm UTC](https://community.glideapps.com/t/date-time-math/15963/67 "2020-10-08T20:14:38Z")

</div>

Then use fractions.  
`DATE-1/24` = minus an hour  
`DATE-1/24/60` = minus a minute  
`DATE-1/24/60/60` = minus a second

---

<div class="post-metadata">

**Author:** ![wjcv06](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/wjcv06/32/12747_2.png) [@wjcv06](https://community.glideapps.com/u/wjcv06)\
**Post date:** [October 8, 2020, 8:20pm UTC](https://community.glideapps.com/t/date-time-math/15963/68 "2020-10-08T20:20:29Z")

</div>

Start: 3:13:12  
End: 5:45:12  
(Start - End)\*24 = 2.5333 hours

I have to do a series of calculations to get this result 2:32 ? 😕

---

<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 8, 2020, 8:37pm UTC](https://community.glideapps.com/t/date-time-math/15963/69 "2020-10-08T20:37:22Z")

</div>

Yes You’ll need to create a series of columns that separate the hour from the fraction of the hour and then do the math to spit back minutes and then combine the two.

---

<div class="post-metadata">

**Author:** ![wjcv06](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/wjcv06/32/12747_2.png) [@wjcv06](https://community.glideapps.com/u/wjcv06)\
**Post date:** [October 8, 2020, 8:39pm UTC](https://community.glideapps.com/t/date-time-math/15963/70 "2020-10-08T20:39:04Z")

</div>

I was afraid of that u.u

---

<div class="post-metadata">

**Author:** ![Pablo\_books](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pablo_books/32/2110_2.png) [@Pablo\_books](https://community.glideapps.com/u/Pablo_books)\
**Post date:** [December 7, 2020, 10:22am UTC](https://community.glideapps.com/t/date-time-math/15963/71 "2020-12-07T10:22:45Z")

</div>

Quick question: If I have a date+time and want to add 24 hours, how would I format it?

---

<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:** [December 7, 2020, 10:25am UTC](https://community.glideapps.com/t/date-time-math/15963/72 "2020-12-07T10:25:00Z")

</div>

Would a “Date + 1” work, in a math column of course?

---

<div class="post-metadata">

**Author:** ![Pablo\_books](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pablo_books/32/2110_2.png) [@Pablo\_books](https://community.glideapps.com/u/Pablo_books)\
**Post date:** [December 7, 2020, 10:28am UTC](https://community.glideapps.com/t/date-time-math/15963/73 "2020-12-07T10:28:28Z")

</div>

Yep, thanks! I didn’t know if +1 added a day or an hour.

---

<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, 12:08am UTC](https://community.glideapps.com/t/date-time-math/15963/74 "2021-01-16T00:08:42Z")

</div>

hi, im trying to calculate duration and it rounding up hours, so it shows 1 hour duration when is more that 30 minutes.  
im using math column (now - date) \* 24 , precision 1  
i just want hours or format H : M : S  
is there a solution whiteout making more columns and trimming result?

---

<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:** [January 16, 2021, 12:11am UTC](https://community.glideapps.com/t/date-time-math/15963/75 "2021-01-16T00:11:46Z")

</div>

You can probably use the `ceiling` function in there somewhere!

---

<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, 12:13am UTC](https://community.glideapps.com/t/date-time-math/15963/76 "2021-01-16T00:13:02Z")

</div>

can i use it in math column?

---

<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:** [January 16, 2021, 12:18am UTC](https://community.glideapps.com/t/date-time-math/15963/77 "2021-01-16T00:18:40Z")

</div>

Yes, in the data editor, the ceiling function only works with a math column.

This may or may not be useful for you.

> [@abacus New Math functions](https://community.glideapps.com/t/new-math-functions/16761/52):
>
> @Rasha I think I got it. I feel pretty good about this one. This formula will calculate the time to the next half hour. It does float between 0 and 1 seconds after the minute, but appears to stick on the exact minute of the next half hour and switching to not show seconds will give you a good view. I did watch the time switch from 5:59 to 6:00 and after that, the value changed from 6:00 to 6:30, so I feel pretty good about it. The kicker here is that this will require a seed date.…

---

<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, 12:23am UTC](https://community.glideapps.com/t/date-time-math/15963/78 "2021-01-16T00:23:21Z")

</div>

perfect, i did not know i can use functions! lol i used:  
floor ((now-date)\*24)  
and it gives me just hours !  
thank you so much!

---

<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:17am UTC](https://community.glideapps.com/t/date-time-math/15963/79 "2021-01-16T01:17:03Z")

</div>

hmm, floor function works only with first row, rest is not affected ;-(

---

<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:** [January 16, 2021, 1:19am UTC](https://community.glideapps.com/t/date-time-math/15963/80 "2021-01-16T01:19:07Z")

</div>

Do you have a screenshot from the data editor showing the math column and the date column you are calculating from?

---

<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:21am UTC](https://community.glideapps.com/t/date-time-math/15963/81 "2021-01-16T01:21:33Z")

</div>

![Proposal 2021-01-15 at 8.19.53 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/7/e71e7d3bf8e895c7d65a3bfadfafd4c5ba4cead1.jpeg) ![Proposal 2021-01-15 at 8.20.35 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/4/f4a984b973f37910924df19e53d232107abe32f5.jpeg)

on second row is 59 min but is only 58.56  
only first row is working good

---

<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:** [January 16, 2021, 1:42am UTC](https://community.glideapps.com/t/date-time-math/15963/82 "2021-01-16T01:42:59Z")

</div>

Maybe I’m confused at what I’m looking at. How is the 58.56 seconds supposed to be affecting the minutes column. I guess what I’m getting at is why is it seconds in a duration so closely matches minutes other than being a highly unlikely coincidence. Or am I just overthinking it and currently the seconds column is really displaying minutes??? Just trying to understand what I’m looking at before trying to figure out why it didn’t round down.

If it makes any of this easier, you do also have hour(), minute(), and second() functions that you can wrap around your duration calculation. Maybe something like `hour(date+(now-date))`, but I’m not quite sure that that will work how you want.

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

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