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 11:09:19
 
 
To
10/03/2008 10:48:41
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01300363
Message ID:
01300497
Views:
21
This message has been marked as a message which has helped to the initial question of the thread.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform