>?day(gomonth(date(),1)-day(gomonth(date(),1)))
>
>>Is there a function available to calulate the # of days in a given month from a date() function?
>>
>>Jeff
Here another different approach.
? get_max_month_day(1, 2000)
? get_max_month_day({^2003-01-31})
FUNCTION get_max_month_day(ncurr_month, ncurr_year)
IF TYPE('ncurr_month')$'DT'
ncurr_year = year(ncurr_month)
ncurr_month = month(ncurr_month)
ENDIF
FOR last_day = 28 TO 31
nmax_date = IIF(EMPTY(DATE(ncurr_year, ncurr_month, last_day)), nmax_date, DATE(ncurr_year, ncurr_month, last_day)) &&Put in a date, if it's not valid it comes out empty.
ENDFOR
RETURN DAY(nmax_date) &&Returns a numeric value indicating the last day of the month.
ENDFUNC
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only