Fun with Dates

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 day 16” to make sure it goes to the next month.

31-(FLOOR(DAY(N)/16))*15
8 Likes