# Math column computing date

**URL:** <https://community.glideapps.com/t/math-column-computing-date/65194>\
**Category:** Ask for Help\
**Created:** [August 19, 2023, 5:19pm UTC](https://community.glideapps.com/t/math-column-computing-date/65194 "2023-08-19T17:19:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mns\_Glide](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mns_glide/32/2514_2.png) [@Mns\_Glide](https://community.glideapps.com/u/Mns_Glide)\
**Post date:** [August 19, 2023, 5:19pm UTC](https://community.glideapps.com/t/math-column-computing-date/65194/1 "2023-08-19T17:19:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dilon\_Perera](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dilon_perera/32/85652_2.png) [@Dilon\_Perera](https://community.glideapps.com/u/Dilon_Perera)\
**Post date:** [August 19, 2023, 6:04pm UTC](https://community.glideapps.com/t/math-column-computing-date/65194/2 "2023-08-19T18:04:57Z")

</div>

Hi @Mns_Glide,

**With Math column :**

> **[Math Column](https://www.glideapps.com/docs/math-column)**
>
> Perform instant calculations using the data in your project.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/8/48cee81e9568fdf9ba4a7e8d8363e3a7327bba62.jpeg)

**ABS(Floor(n-e))**

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/0/a0de6f2019496ece9e9224e7e1b68b1e5b2d2b76.png)

* * *

**With JavaScript column :**

```auto
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 ;
}

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/c/3c5e88769076b5b7420c8dd4b73301d77c60ab18.png)

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

Thank you

---

<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:** [August 20, 2023, 1:07am UTC](https://community.glideapps.com/t/math-column-computing-date/65194/3 "2023-08-20T01:07:11Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/7/f78b4f482c43b6033956d77f882802d503d7115d.png)

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

---

<div class="post-metadata">

**Author:** ![Mns\_Glide](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mns_glide/32/2514_2.png) [@Mns\_Glide](https://community.glideapps.com/u/Mns_Glide)\
**Post date:** [August 20, 2023, 11:20pm UTC](https://community.glideapps.com/t/math-column-computing-date/65194/4 "2023-08-20T23:20:54Z")

</div>

thanks Dilon and Thinh.

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

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [August 27, 2023, 11:21pm UTC](https://community.glideapps.com/t/math-column-computing-date/65194/5 "2023-08-27T23:21:01Z")

</div>

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