🆕 Date-time Math

Or maybe a template column to duplicate.

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

1 Like

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.

2 Likes

If I need substract hours, minutes, seconds?

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

3 Likes

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 ? :confused:

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.

3 Likes

I was afraid of that u.u

1 Like

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

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

2 Likes

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

2 Likes

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?

You can probably use the ceiling function in there somewhere!

can i use it in math column?

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

This may or may not be useful for you.

1 Like

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!

1 Like

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

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

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

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.