Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Last day of month, last tuesday of month, etc
Message
From
10/03/2008 12:34:18
 
 
To
10/03/2008 11:09:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01300363
Message ID:
01300542
Views:
16
thanks!

>Updated code and tested...
>
>
>*  Call passing the day number of week to test for and current date
>*  Returns:  1 after date
>*            2 before date
>*            3 equals date
>*            0 indeterminate (error)
>
>FUNCTION LastDaySelect
>LPARAMETERS pnLastDay,pdCurDate
>LOCAL ldLastDayofMonth, lnLastDay, lnDate
>ldLastDayofMonth = GOMONTH(DATE(YEAR(pdCurDate),MONTH(pdCurDate),1),1) - 1
>lnLastDay = DOW(ldLastDayofMonth)
>IF (lnLastDay - pnLastDay) > 0
>  ldTestDayofMonth = ldLastDayofMonth - (lnLastDay - pnLastDay)
>ELSE
>  ldTestDayofMonth = ldLastDayofMonth - (pnLastDay + lnLastDay) + 1
>ENDIF
>DO CASE
>  CASE ldTestDayofMonth < pdCurDate
>    lnDate = 1
>  CASE ldTestDayofMonth > pdCurDate
>    lnDate = 2
>  CASE ldTestDayofMonth = pdCurDate
>    lnDate = 3
>  OTHERWISE
>    lnDate = 0
>ENDCASE
>RETURN lnDate
>ENDFUNC
>
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform