# Fun with Dates

**URL:** <https://community.glideapps.com/t/fun-with-dates/21684>\
**Category:** Project Showcase\
**Created:** [January 24, 2021, 8:25pm UTC](https://community.glideapps.com/t/fun-with-dates/21684 "2021-01-24T20:25:08Z")\
**Posts on this page:** 1\
**Showing post:** 134

<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:** [June 11, 2021, 11:55pm UTC](https://community.glideapps.com/t/fun-with-dates/21684/134 "2021-06-11T23:55:06Z")

</div>

Jean-Claude does not stop here hehe.

Darren’s idea made me think about a formula to derive the current month’s number of days.

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

And here we go! Tested some timestamps.

```auto
N+31-(FLOOR(DAY(N)/16))*15+1-DAY(N+31-(FLOOR(DAY(N)/16))*15)
-
(N+1-DAY(N))

```

Edit: Realized a bug with 28 is that when you start with dates like 1, 2 in a 31-day month then it does not convert. Back to the drawing board.

Edit 2: Derived a way to add 16 days when it’s “day 16 or more”, and 31 days when it’s “less than day 16” to make sure it goes to the next month.

```auto
31-(FLOOR(DAY(N)/16))*15
```

---

_[View the full topic](https://community.glideapps.com/t/fun-with-dates/21684)._
