Get the days of the current month

Hello, how do you find them? One question, is it possible to get the days of a month? For example, I would like to obtain a formula perhaps where I can obtain how many days the current month has, for example if we are in October and this month has 31 days, then I want to return 31, something that is based on the current date.

Use this in a math column:

DAY((Date - DAY(Date) + 32) - DAY(Date - DAY(Date) + 32))

where Date is now or your date.

Took me a while to get this and had to use the other examples in the community as a guide and also ChatGPT to assist :wink:

4 Likes

32 seems safe enough, but 45 would be yet safer to stay away from the edges of the month.

Here you’ll find a bunch of useful formulas:

1 Like

oh that also works perfectly - is there a reason why 45 works so well? cause in the solutions in the community I mostly see 45

It’s just an arbitrary number that is guaranteed to always land somewhere in the middle of the next month, regardless of how many days in the month.

3 Likes

If you’re on the 1st of the month, +32 will bring to the beginning of the following month. Really I think +31 would work too. If you want to land far from the beginning or the end of the month, you need to add two weeks. So as Darren said, +45 is totally arbitrary, but it’s safe to keep you away from the edges.

1 Like

I see alright, while 32 works, 45 is best. Also, I tried with 31 but it didn’t get it right for October.
Thank you both.

1 Like

Anything between 32 and 56 (or so) should work. 45 happens to be smack in the middle (or just about).

1 Like

45 simply works because it’s the number our own @Jeff_Hager has chosen.

4 Likes

“Middle of the month” using something like 15 or 45 has more of a purpose when trying to add several months or years to a date. Since each month has a different number of days, the resulting date can sometimes float around, so aiming for the middle of the month allows for some wiggle room when doing the math. In this particular case, 32 works just fine since the goal is just to get to the last day of the current month and 32 puts you safety into the next month.

3 Likes

I have been reading your comments, and I thank all the Glide experts who help me learn new logics that I had not implemented. Every day I continue learning about Glide in conjunction with your comments in different posts.

3 Likes

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