Holiday Finder

Use this script to get a DateTime object representing the holiday you wish to
lookup.
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
Sub Initialize
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
Call find_holiday(h_year,h_dow,h_mon,h_which)
End Sub
Function find_holiday(h_year,h_dow,h_mon,h_which)
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))
Else
Call search.AdjustDay(h_dow - s_dow)
End If
week_number = 1
While(week_number <> h_which)
Call search.AdjustDay(7)
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"
Exit Function
Else
Call.search.Adjustday(-7)
Goto break_out
End If
End If
Wend
break_out:
End Function
This was first published in November 2000

Dig deeper on Domino Resources - Part 5

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close