Math column computing date

Hi,
I am trying to use Math computed column to determine how many days to go before a user’s membership expires. I seem to be getting very strange numbers. I have formatted dates to be in dd/MM/yyyy

eg expiry date - NOW → 31/7/2024 - 20/8/2023. I am getting result of 10, 990, 001. If I divide the result by 86400 seconds, I get 127 days. This seems to also be wrong.

Please advise what value the result of 10, 990, 001 and how do I convert to days.

Thank you

Hi @Mns_Glide,

With Math column :

ABS(Floor(n-e))

image


With JavaScript column :

if (p1) {
  const currentDate = new Date();
  const expiryDate = new Date(p1);
  const timeDifference = expiryDate - currentDate;
  const daysRemaining = Math.abs(Math.ceil(timeDifference / (1000 * 60 * 60 * 24)));

  return daysRemaining;
} else {
  return ;
}

Hope I’m correct! If not please let me know!

Thank you

There’s also this column if you want to try it out.

2 Likes

thanks Dilon and Thinh.

the floor (e-n) fits my requirements.
Much appreciated!

2 Likes

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