public static DateTime CalculateOccurrenceDate(
int year,
int month,
DayOccurrence occur,
DaysOfWeek days,
int offset
)
Public Shared Function CalculateOccurrenceDate (
year As Integer,
month As Integer,
occur As DayOccurrence,
days As DaysOfWeek,
offset As Integer
) As DateTime
public:
static DateTime CalculateOccurrenceDate(
int year,
int month,
DayOccurrence occur,
DaysOfWeek days,
int offset
)
static member CalculateOccurrenceDate :
year : int *
month : int *
occur : DayOccurrence *
days : DaysOfWeek *
offset : int -> DateTime
This method is intended for use in finding an occurrence of any one of a set of days of the week and is normally used with the Weekdays or Weekends day of week value. However, the days of week parameter can be any valid combination of days including an individual day of the week.
Use a positive value for the nOffset parameter for a number of days after the calculated date or a negative number for a number of days before the calculated date.
Normally, this value will be zero so that the calculated date is the actual date returned. However, in cases where a date is calculated in terms of the number of days before or after a given date, this can be set to the offset to adjust the calculated date. Note that if used, the date returned may not be on one of the days of the week specified to calculate the original unadjusted date.
// Returns 01/06/2004 (fourth weekday in Jan 2004)
dtFourthWeekday = DateUtils.CalculateOccurrenceDate(2004, 1,
DayOccurrence.Fourth, DaysOfWeek.Weekdays, 0);
// Returns 01/08/2004 (fourth weekday plus 2 days)
dtPlusTwo = DateUtils.CalculateOccurrenceDate(2004, 1,
DayOccurrence.Fourth, DaysOfWeek.Weekdays, 2);
' Returns 01/06/2004 (fourth weekday in Jan 2004)
dtFourthWeekday = DateUtils.CalculateOccurrenceDate(2004, 1,
DayOccurrence.Fourth, DaysOfWeek.Weekdays, 0)
' Returns 01/08/2004 (fourth weekday plus 2 days)
dtPlusTwo = DateUtils.CalculateOccurrenceDate(2004, 1,
DayOccurrence.Fourth, DaysOfWeek.Weekdays, 2)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
ArgumentException | This is thrown if None is passed for the DayOccurrence parameter. |