DateTimeExtensionsOrdinalDate(OrdinalWeekday, DayOfWeek, Int32, Int32, Int32) Method |
Returns the date of the nth occurrence of a particular
weekday in a given month.
Namespace: InnerDrive.CoreAssembly: InnerDrive.Core (in InnerDrive.Core.dll) Version: 5.0.8475.0
Syntax public static DateTime OrdinalDate(
OrdinalWeekday occurrence,
DayOfWeek dayOfWeek,
int year,
int month,
int day
)
Parameters
- occurrence OrdinalWeekday
- The number of the occurrence.
- dayOfWeek DayOfWeek
- The day of week to use.
- year Int32
- The calendar year to use.
- month Int32
- The month to use, where 1 = January and 12 = December.
- day Int32
- The day of the month to use as the lower limit
of the result. (See remarks.)
Return Value
DateTimeA
DateTime structure representing the date
sought.
Remarks The
day parameter is the lower limit of the day
of the month to use. In other words, you can find the first occurrence of
a weekday after a particular day using this overload by supplying the
following day for the
day parameter.
If the value of day is greater than the
last occurrence of dayOfWeek, the last occurrence
is returned.
The following table shows the output of the OrdinalDate method:
Example var electionDay =
DateTimeExtensions.OrdinalDate(OrdinalWeekday.Second, DayOfWeek.Tuesday, 2014, 11, 1);
See Also