Domino Code Fragment

Code Name*
What's the date of the Last Thursday in November?
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.14.80.45
Description*
In the following function getdateByWeekDayFromBack(1998,11,1,5) returns the last Thursday of Nov.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:



Function getdateByWeekDayFromBack(vyear As Integer, vmonth As Integer, vweek As Integer, vweekday As Integer) As Variant
   Dim ldate As Variant
   Dim iweekdate As Integer
   ldate = Datenumber(vyear,vmonth,28)
   iweekdate = Weekday(ldate)
   If vweekday >= iweekdate Then
        ldate = ldate + vweekday - iweekdate
   Else
        ldate = ldate + 7- (iweekdate - vweekday)
   End If    
   If Month(ldate ) <> vmonth Then
        ldate = ldate - 7
   End If
   ldate =  ldate - (vweek -1)
   getdateByWeekDayFromBack = ldate
   
End Function