# Magic (or not) formula 😁

**URL:** <https://community.glideapps.com/t/magic-or-not-formula/44113>\
**Category:** Ask for Help\
**Created:** [July 8, 2022, 10:15am UTC](https://community.glideapps.com/t/magic-or-not-formula/44113 "2022-07-08T10:15:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [July 8, 2022, 10:22am UTC](https://community.glideapps.com/t/magic-or-not-formula/44113/2 "2022-07-08T10:22:14Z")

</div>

> [@Fun with Dates](https://community.glideapps.com/t/fun-with-dates/21684/134):
>
> 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. And here we go! Tested some timestamps. 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 …

---

_[View the full topic](https://community.glideapps.com/t/magic-or-not-formula/44113)._
