RecurrenceInstancesBetween Method

This method is used to return all recurring instances between the two specified date/times based on the current settings.

Definition

Namespace: EWSoftware.PDI
Assembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2023.1.2.0
public DateTimeCollection InstancesBetween(
	DateTime fromDate,
	DateTime toDate
)

Parameters

fromDate  DateTime
The minimum date/time on or after which instances should occur
toDate  DateTime
The maximum date/time on or before which instances should occur

Return Value

DateTimeCollection
Returns a DateTimeCollection of DateTime objects that represent the instances found between the two specified date/times.

Example

C#
// Set up an instance that recurs on the third Tuesday every two months and ends in
// three years.
Recurrence rRecur = new Recurrence();

rRecur.RecurMonthly(DayOccurrence.Third, DaysOfWeek.Tuesday, 2);
rRecur.StartDateTime = DateTime.Today;
rRecur.RecurUntil = DateTime.Today.AddYears(3);

// Get all instances that occur between 12 and 24 months from now
DateTimeCollection recurDates = rRecur.InstancesBetween(
    DateTime.Today.AddMonths(12), DateTime.Today.AddMonths(24);

See Also