DateUtility Class
Provides utility methods to work with dates.
public static class DateUtilityMethods
| Name | Description |
|---|---|
| GetDaysFromStartOfWeek(DayOfWeek) | Returns the amount of full days separating a given day of the week from the first day of the same week, according to the current culture. |
| GetDaysFromStartOfWeek(DayOfWeek, DayOfWeek) | Returns the amount of full days separating a given day of the week from the first day of the same week, if a given day is considered the first of the week. |
| GetDaysFromStartOfWeek(DayOfWeek, CultureInfo) | Returns the amount of full days separating a given day of the week from the first day of the same week, according to the specified culture. |
| GetDaysFromStartOfWeek(DayOfWeek, DateTimeFormatInfo) | Returns the amount of full days separating a given day of the week from the first day of the same week, according to the specified formatting information. |
GetDaysFromStartOfWeek overloads
GetDaysFromStartOfWeek(DayOfWeek)
Returns the amount of full days separating a given day of the week from the first day of the same week, according to the current culture.
Parameters
Returns
int An integer number between 0 and 6 representing the days between the start of the week and today, according to the current culture.
See also
GetDaysFromStartOfWeek(DayOfWeek, DayOfWeek)
Returns the amount of full days separating a given day of the week from the first day of the same week, if a given day is considered the first of the week.
GetDaysFromStartOfWeek(DayOfWeek, CultureInfo)
Returns the amount of full days separating a given day of the week from the first day of the same week, according to the specified culture.
public static int GetDaysFromStartOfWeek(DayOfWeek today, CultureInfo culture)Parameters
todayDayOfWeek- A
DayOfWeekvalue. cultureCultureInfo- An object that supplies culture-specific information.
Returns
int An integer number between 0 and 6 representing the days between the start of the week and today, according to culture.
Exceptions
ArgumentNullExceptioncultureisnull.
See also
GetDaysFromStartOfWeek(DayOfWeek, DateTimeFormatInfo)
Returns the amount of full days separating a given day of the week from the first day of the same week, according to the specified formatting information.
public static int GetDaysFromStartOfWeek(DayOfWeek today, DateTimeFormatInfo dateTimeFormat)Parameters
todayDayOfWeek- A
DayOfWeekvalue. dateTimeFormatDateTimeFormatInfo- An object that supplies culture-specific date formatting information.
Returns
int An integer number between 0 and 6 representing the days between the start of the week and today, according to dateTimeFormat.
Exceptions
ArgumentNullExceptiondateTimeFormatisnull.