DateOnlyExtensions Class
Provides extension methods for instances of DateOnly.
This type is not available in the netstandard and .NET Framework builds of Louis, because their BCL has no DateOnly.
public static class DateOnlyExtensionsMethods
| Name | Description |
|---|---|
| DateOnly.GetEndOfMonth() | Given a date, returns the last day of the same month. |
| DateOnly.GetEndOfWeek() | Given a date, returns the last day of the same week, according to the current culture. |
| DateOnly.GetEndOfWeek(DayOfWeek) | Returns the earliest date, greater or equal to a given date, whose day of the week is the one preceding a specified day of the week. |
| DateOnly.GetEndOfWeek(CultureInfo) | Given a date, returns the last day of the same week, according to the specified culture. |
| DateOnly.GetEndOfWeek(DateTimeFormatInfo) | Given a date, returns the last day of the same week, according to the specified formatting information. |
| DateOnly.GetStartOfMonth() | Given a date, returns the first day of the same month. |
| DateOnly.GetStartOfWeek() | Given a date, returns the first day of the same week, according to the current culture. |
| DateOnly.GetStartOfWeek(DayOfWeek) | Returns the most recent date, earlier or equal to a given date, whose day of the week is equal to a specified day of the week. |
| DateOnly.GetStartOfWeek(CultureInfo) | Given a date, returns the first day of the same week, according to the specified culture. |
| DateOnly.GetStartOfWeek(DateTimeFormatInfo) | Given a date, returns the first day of the same week, according to the specified formatting information. |
DateOnly.GetEndOfMonth()
Available in: net10.0net11.0(not available in the other target frameworks of the package)
DateOnly.GetEndOfWeek overloads
DateOnly.GetEndOfWeek()
Available in: net10.0net11.0(not available in the other target frameworks of the package)
DateOnly.GetEndOfWeek(DayOfWeek)
Available in: net10.0net11.0(not available in the other target frameworks of the package)
Returns the earliest date, greater or equal to a given date, whose day of the week is the one preceding a specified day of the week.
Parameters
thisDateOnly- The instance of
DateOnlyon which this method is called. firstDayOfWeekDayOfWeek- A
DayOfWeekvalue representing the day that starts the week.
Returns
DateOnly An instance of DateOnly whose value represents the last day of the week of this, if weeks are considered starting with firstDayOfWeek.
See also
DateOnly.GetEndOfWeek(CultureInfo)
Available in: net10.0net11.0(not available in the other target frameworks of the package)
Given a date, returns the last day of the same week, according to the specified culture.
extension(DateOnly @this)
{
public DateOnly GetEndOfWeek(CultureInfo culture)
}Parameters
thisDateOnly- The instance of
DateOnlyon which this method is called. cultureCultureInfo- An object that supplies culture-specific information.
Returns
DateOnly An instance of DateOnly whose value represents the last day of the week of this, according to culture.
Exceptions
ArgumentNullExceptioncultureisnull.
See also
DateOnly.GetEndOfWeek(DateTimeFormatInfo)
Available in: net10.0net11.0(not available in the other target frameworks of the package)
Given a date, returns the last day of the same week, according to the specified formatting information.
extension(DateOnly @this)
{
public DateOnly GetEndOfWeek(DateTimeFormatInfo dateTimeFormat)
}Parameters
thisDateOnly- The instance of
DateOnlyon which this method is called. dateTimeFormatDateTimeFormatInfo- An object that supplies culture-specific date formatting information.
Returns
DateOnly An instance of DateOnly whose value represents the last day of the week of this, according to dateTimeFormat.
Exceptions
ArgumentNullExceptiondateTimeFormatisnull.
See also
DateOnly.GetStartOfMonth()
Available in: net10.0net11.0(not available in the other target frameworks of the package)
DateOnly.GetStartOfWeek overloads
DateOnly.GetStartOfWeek()
Available in: net10.0net11.0(not available in the other target frameworks of the package)
DateOnly.GetStartOfWeek(DayOfWeek)
Available in: net10.0net11.0(not available in the other target frameworks of the package)
Returns the most recent date, earlier or equal to a given date, whose day of the week is equal to a specified day of the week.
Parameters
thisDateOnly- The instance of
DateOnlyon which this method is called. firstDayOfWeekDayOfWeek- A
DayOfWeekvalue representing the day that starts the week.
Returns
DateOnly An instance of DateOnly whose value represents the first day of the week of this, if weeks are considered starting with firstDayOfWeek.
See also
DateOnly.GetStartOfWeek(CultureInfo)
Available in: net10.0net11.0(not available in the other target frameworks of the package)
Given a date, returns the first day of the same week, according to the specified culture.
extension(DateOnly @this)
{
public DateOnly GetStartOfWeek(CultureInfo culture)
}Parameters
thisDateOnly- The instance of
DateOnlyon which this method is called. cultureCultureInfo- An object that supplies culture-specific information.
Returns
DateOnly An instance of DateOnly whose value represents the first day of the week of this, according to culture.
Exceptions
ArgumentNullExceptioncultureisnull.
See also
DateOnly.GetStartOfWeek(DateTimeFormatInfo)
Available in: net10.0net11.0(not available in the other target frameworks of the package)
Given a date, returns the first day of the same week, according to the specified formatting information.
extension(DateOnly @this)
{
public DateOnly GetStartOfWeek(DateTimeFormatInfo dateTimeFormat)
}Parameters
thisDateOnly- The instance of
DateOnlyon which this method is called. dateTimeFormatDateTimeFormatInfo- An object that supplies culture-specific date formatting information.
Returns
DateOnly An instance of DateOnly whose value represents the first day of the week of this, according to dateTimeFormat.
Exceptions
ArgumentNullExceptiondateTimeFormatisnull.