Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a function that returns the number of days in a
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00440276
Message ID:
00440545
Views:
12
You're a math major aren't you, Houston? LOL Back at those numbers again I see. Hey, I haven't had time to try the never version of your Business Day Calculator so don't think I've blown you off. I got your original version working and haven't had time to test the new one. I'll let you know when I do though. Have a great weekend!


>>>>>Is there a function that returns the number of days in a month?
Anybody see anything wrong with:
CLEAR
>FOR iyear = 1999 to 2001
>   FOR iMonth = 1 TO 12
>     iDaysInMonth = fDaysInMonth2( iYear, iMonth )
>      ? DATE( iYear, iMonth, iDaysInMonth ), iDaysInMonth
>   NEXT iMonth
>   ?
>NEXT iYear
>RETURN .T.
>
>**************************************
>FUNCTION fDaysInMonth( iYear, iMonth )
>**************************************
>   IF iMonth < 12
>      dEndOfMOnth = DATE( iYear, iMonth+1, 1 ) -1
>   ELSE
>      dEndOfMOnth = DATE( iYear+1, 1, 1 ) -1
>   ENDIF
>   RETURN DAY( dEndOfMOnth )
>   ENDFUNC  && fDaysInMonth( iYear, iMonth )
>
>*- Or as a one-liner:
>
>***************************************
>FUNCTION fDaysInMonth2( iYear, iMonth )
>***************************************
>   RETURN DAY( IIF( iMonth < 12 ;
>                   , DATE( iYear, iMonth+1, 1 ) -1  ;
>                   , DATE( iYear+1, 1, 1 ) -1  ))
>   ENDFUNC  && fDaysInMonth( iYear, iMonth )
Everything we see or seems
Is but a dream within a dream
- Edgar Allen Poe
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform