Formula to calc number of days in a given month

FrostByte

Registered User.
Local time
Today, 18:15
Joined
Jan 15, 2015
Messages
56
Im trying do do what I think should be simple i.e. calculate the number of days in a given month but I cannot work it out.

Any help you be appreciated.
 
the easiest way is to set a date equal to the first of the following month, and subtract one. That gives you the last day of the previous month, and then you can use the DAY() function.
Alternatively, have an array set to {31,28,31,30 etc), although you still get the issue with the leap day that way.
 
This thread covers a few different ways:-

 
I seem to recall @Pat Hartman uploaded a db with handy date routines? Search for it here.
 
How about?
Code:
Day(DateSerial(Year(DateField), Month(DateField)+1, 0))
You didn't say how you're going to supply the month to search, so I just assumed you will use a date value.
Hope that helps...
 

Users who are viewing this thread

Back
Top Bottom