GetSpecialDay

Purpose

This function returns a date object representing the requested special date. e.g. The Third Thursday of November.

Parameters

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 retrieve, 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.

Optional Parameter: GetNext
Type: Boolean (Default value if not provided = False)
Description: If the requested special date has already passed and GetNext is True, then the next instance of the requested special day will be returned. (See the example below)

Returns

Return value: date requested
Type: date
Description: This is a date object with the month, day, year components for the special day requested.

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 dteReturn As Date

  dteReturn = hs.GetSpecialDay(DOW, Inst, ForMonth, False)
  hs.WriteLog("Test","With GetNext False, Result is " & dteReturn.ToShortDateString)

  dteReturn = hs.GetSpecialDay(DOW, Inst, ForMonth, True)
  hs.WriteLog("Test","With GetNext True, Result is " & dteReturn.ToShortDateString)

End Sub

The example above returns:

 ~!~Test~!~With GetNext False, Result is 2/15/2006
~!~Test~!~With GetNext True, Result is 3/15/2006

See Also

IsSpecialDay