Different between 2 dates using Math and Day

Dear Community

Wondering how come the first 2 row’s values are correct, but not the last 2 row’s

They all look wrong to me :wink:

Assuming that you want the number of days between the Due Date and the Current Date, try this instead:

Floor(Now - Due)

For Now, use the special Now value - there is no need to create a separate math column for that.

Oh yes, you are right, even the first 2 rows are incorrect. Thanks for the correction.

Btw, what’s Floor ? Where can i see all the special terms and formula available in Glide?

Floor is a standard math function - it returns the highest integer thats less than or equal to the given number. So for example, 7.5 would become 7.

The reason I suggested using floor in this case is because your date values probably also contain a time component, which may give unexpected results. So using floor discards the time part. Also, subtracting one date from another gives a duration as a result (hh:mm:ss). Using floor converts that duration to an integer (number of days).

Below you’ll find a list of all math functions that Glide supports:

1 Like

Just to explain the problem with the following formula:
day(Now) - day(Due)

What the ‘day’ function does is extract the day number from each date, and then you are subtracting that day number.
So, for example, today is the 30th and your due date is the 5th.
So in reality, your formula was doing this:
30-5 = 25

Dates can be finicky when trying to understand how do do math with them.

1 Like

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