IsSpecialDay

Purpose

This function returns a Boolean (True/False) indicating if a date provided is the special day indicated.

Parameters

Parameter: In Date
Type: date
Description: This date object references the date you wish to check.

Parameter: DOW
Type: DayOfWeek (Enum - Integer)
Description: This is the day of the week value you are looking for.  The values for the Enum are as follows:
SUNDAY = 0
MONDAY = 1
TUESDAY = 2
WEDNESDAY = 3
THURSDAY = 4
FRIDAY = 5
SATURDAY = 6
WEEKDAY = 7
WEEKEND_DAY = 8

Parameter: Instance
Type: CD_DAY_IS_Type (Enum - Integer)
Description: This is the instance day that you wish to compare, using these values:
FIRST = 1
SECOND = 2
THIRD = 3
FOURTH = 4
LAST = 5

Parameter: For Month
Type: date
Description: This date object references the month you are requesting the special date for - the day component of the month is not used.  For example, to get the third Thursday in November of 2006, provide a date object set to any day/time in the month of November, 2006.

Returns

Return value: Is Special
Type: Boolean (True/False)
Description: If In Date matches the special day information indicated with the other three parameters, then Is Special will be True, otherwise False.

Example

Sub Main(parm as object)

 Dim DOW as Integer = 3    ' Wednesday
 Dim Inst as Integer = 3      ' Third instance (e.g. Third Wednesday of the month)
 Dim ForMonth As Date = DateTime.Parse("February 3, 2006")
 Dim InDate As Date = DateTime.Parse("February 15, 2006")
 Dim bReturn As Boolean

 bReturn = hs.IsSpecialDay(InDate, DOW, Inst, ForMonth)
 If bReturn = True Then
     hs.WriteLog("Test","February 15 is the third Wednesday of February, 2006")
 Else
     hs.WriteLog("Test","February 15 is the third Wednesday of February, 2006")
 End If

End Sub

See Also

GetSpecialDay