By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
Used to find date of holidays that fall on different days of the year obviously.
Example US Thanksgiving is the 4th Thursday of November
Dim search As notesdatetime
h_year = 2000 ' year of desired date
h_dow = 5 ' represents the day of week.. sunday being 1 saturday being 7
h_mon = "November" ' This is the month that you want the holiday listed.
h_which = 4 ' numeric value of how many of the day of week. This example
' will return the 4th thursday in november [Thanksgiving US]
' For last week.. use 10
Dim dayofweek As Variant
Set search = New notesdatetime(h_mon + " 1, " + Str(h_year))
dayofweek = Evaluate("@WeekDay([" + search.localtime + "])")
s_month = Evaluate("@Month([" + search.localtime + "])")
s_dow = dayofweek(0)
If(s_dow > h_dow) Then
Call search.AdjustDay(7 - (s_dow - h_dow))
Call search.AdjustDay(h_dow - s_dow)
week_number = 1
While(week_number <> h_which)
week_number = week_number + 1
c_month = Evaluate("@Month([" + search.localtime + "])")
If(c_month(0) <> s_month(0)) Then ' went beyond end of month
If(c_which <> 10) Then
Msgbox " Error: Number of weeks exceeded month limit"