Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Days in a Month
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00757135
Message ID:
00757261
Views:
9
>?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
Map
View

Click here to load this message in the networking platform