Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Is there any function which gives me the number of days in a month and takes month as input parameter.
Ex: NumberOfDays(JAN) = 31 DAYS
NumberOfDays(APR) = 30 DAYS
I think you can use day() function on monthend() to calculate this, e.g. if MONTHFIELD is the input month (and it is a numeric month value or a dual, just like month(DATE) would return), try
=Day(MonthEnd(Makedate(Year(Today()),MONTHFIELD)))
this calculates the number of day of a month for this year (to state a year is relevant for leap years / February day numbers).
Hi,
Never did it, but maybe AddMonths() function can help as follows - NoOfDaysInMonth = AddMonths(FirstDateOfMonth, 1) - FirstDateOfMonth.
Not sure if syntax is ok but this is what the first thing that comes to mind.
Best regards,
Maxim
I think you can use day() function on monthend() to calculate this, e.g. if MONTHFIELD is the input month (and it is a numeric month value or a dual, just like month(DATE) would return), try
=Day(MonthEnd(Makedate(Year(Today()),MONTHFIELD)))
this calculates the number of day of a month for this year (to state a year is relevant for leap years / February day numbers).
Great!
MonthEnd() and MonthStart() make it even more logical, I've just tried the following:
=Floor(MonthEnd(Today()))-Floor(MonthStart(Today()))+1
It works, just replace Today() with the date you need.
Best regards,
Maxim