public static class DateOnlyExtensions
[ExtensionAttribute]
public ref class DateOnlyExtensions abstract sealed
No code example is currently available or this language may not be supported.
Add | Adds a timespan to a DateOnly object. If the timespan is less than a whole day, the same value is returned |
AddHours | Adds hours to a DateOnly object. If the value is less than 24 hours (a whole day), the same Date is returned |
AddMilliseconds | Adds minutes to a DateOnly object. If the values is less than a 86_400_000 seconds (a whole day), the same value is returned |
AddMinutes | Adds minutes to a DateOnly object. If the values is less than a 1440 minutes (a whole day), the same value is returned |
AddSeconds | Adds minutes to a DateOnly object. If the values is less than a 86_400 seconds (a whole day), the same value is returned |
AddTicks | Adds a number of ticks to a DateOnly object. If the number of ticks is less than a whole day, the same value is returned |
AddWeeks | Adds weeks to a DateOnly object |
Difference | Calculates the difference of two DateOnlyRanges. If the two ranges do not overlap, the result is the first DateOnlyRange. Otherwise, the result is the first DateOnlyRange without where both ranges overlap. |
Distance | Returns the distance as a TimeSpan between two DateOnly objects. The result is always positive |
DoesOverlap | Verifies if DateOnlyRange a overlapps with DateOnlyRange b. |
EndOfMonth | Returns a DateTime object representing the last day of the current month |
EndOfWeek | Returns a DateTime object representing the last day of the current Week |
EnumerateDaysUntil | Enumerates all days startDate current DateOnly value endDate the end DateOnly, including the end date |
EnumerateHolidaysUntil | Enumerates all holidays startDate current DateOnly value endDate the end DateOnly, including the end date |
EnumerateInStepsUntil(DateOnly, DateOnly, TimeSpan) |
Enumerates starting with the startDate date, until the endDate date in steps of distance When the distance is negative, the start date must be greater than the end date, and the enumeration goes backwards |
EnumerateInStepsUntil(DateOnly, DateOnly, TimeSpan, FuncDateOnly, Boolean) | Enumerates starting with startDate until endDate in steps of distance |
EnumerateMonthsUntil | Enumerates all months startDate current DateOnly value endDate the end DateOnly, including the end date |
EnumerateWeekendsUntil | Advances to the closest weekend and enumerates the weekends until the end date. The weekend date is always a saturday when going forward and a sunday when going backwards. |
EnumerateWorkdaysUntil | Enumerates all working days startDate current DateOnly value endDate the end DateOnly, including the end date |
EnumerateYearsUntil | Enumerates all years startDate current DateOnly value endDate the end DateOnly, including the end date |
FirstFridayOfMonth | Returns the first Friday of the month |
FirstMondayOfMonth | Returns the first Monday of the month |
FirstSaturdayOfMonth | Returns the first Saturday of the month |
FirstSundayOfMonth | Returns the first Sunday of the month |
FirstThursdayOfMonth | Returns the first Thursday of the month |
FirstTuesdayOfMonth | Returns the first MoTuesday of the month |
FirstWednesdayOfMonth | Returns the first Wednesday of the month |
FirstWeekdayOfMonth | Returns the first given weekday in the month |
Intersection | Calculates the intersection of two DateOnlyRanges. If the two ranges do not overlap, the result is an empty DateOnlyRange. Otherwise, the result is the DateOnlyRange that where both ranges overlap. |
IsBetween | Checks if the given value is between the given startDate and endDate values, excluding the start and end value |
IsEqual | Compares two dates for equality down to the given precision |
IsEqualDownToDay | Compares two dates for equality down to the year (hours, minutes, seconds and milliseconds are ignored) |
IsEqualDownToMonth | Compares two dates for equality down to the year (days, hours, minutes, seconds and milliseconds are ignored) |
IsEqualDownToWeek | Compares two dates for equality down to the week (hours, minutes, seconds and milliseconds are ignored) |
IsEqualDownToYear | Compares two dates for equality down to the year (months, days, hours, minutes, seconds and milliseconds are ignored) |
IsPublicHoliday | Checks if the given date falls on a Saturday or Sunday |
IsSameDay(DateOnly, DateOnly) | Verifies if the two dates are the same day of the month |
IsSameDay(DateOnly, DateTime) | Verifies if the two dates are the same day of the month |
IsSameMonth(DateOnly, DateOnly) | Verifies if the two dates are the same month |
IsSameMonth(DateOnly, DateTime) | Verifies if the two dates are the same month |
IsSameWeek(DateOnly, DateOnly, CultureInfo) | Verifies if the two dates are the same week |
IsSameWeek(DateOnly, DateTime, CultureInfo) | Verifies if the two dates are the same week |
IsSameWeekday(DateOnly, DateOnly) | Verifies if the two dates are the same weekday |
IsSameWeekday(DateOnly, DateTime) | Verifies if the two dates are the same weekday |
IsSameYear(DateOnly, DateOnly) | Verifies if the two dates are the same year |
IsSameYear(DateOnly, DateTime) | Verifies if the two dates are the same year |
IsWeekend | Checks if the given date falls on a Saturday or Sunday |
IsWithin(DateOnly, DateOnlyRange) | Checks if the given value is between the given start and end values, including start date and end date |
IsWithin(DateOnly, DateOnly, DateOnly) | Checks if the given value is within the given startDate and endDate values, including startDate and endDate |
IsWithin(DateOnly, DateTime, DateTime) | Checks if the given value is within the given startDate and endDate values, including startDate and endDate |
LastFridayOfMonth | Returns the last Friday of the month |
LastMondayOfMonth | Returns the last Monday of the month |
LastSaturdayOfMonth | Returns the last Saturday of the month |
LastSundayOfMonth | Returns the last Sunday of the month |
LastThursdayOfMonth | Returns the last Thursday of the month |
LastTuesdayOfMonth | Returns the last Tuesday of the month |
LastWednesdayOfMonth | Returns the last Wednesday of the month |
LastWeekdayOfMonth | Returns the last given weekday of the month |
NextDay | Gets the DateOnly value of the next day |
NextHoliday |
Gets the DateOnly value of the next holiday Holidays are calculated through the IHolidayProvider interface in DateTimeExtensions. |
NextMonth | Gets the DateOnly value of the next month, first day |
NextWeek | Gets the DateOnly value of the same day in the next week |
NextWeekend | Gets the DateOnly value of the next weekend following this date. If the given date is already a weekend, the next weekend is returned. |
NextWorkday | Gets the DateOnly value of the same day in the next week |
NextYear | Gets the DateOnly value of the next year, first month, first day |
NumberOfDaysUntil | Count the number of Days between startDate and endDate |
NumberOfDecadesUntil | Count the number of Decades between startDate and endDate |
NumberOfHolidaysUntil | Count the number of Holidays between startDate and endDate |
NumberOfHoursUntil | Count the number of Hours between startDate and endDate |
NumberOfMillisecondsUntil | Count the number of Milliseconds between startDate and endDate |
NumberOfMinutesUntil | Count the number of Minutes between startDate and endDate |
NumberOfMonthsUntil | Count the number of Months between startDate and endDate |
NumberOfSecondsUntil | Count the number of Seconds between startDate and endDate |
NumberOfSemestersUntil | Count the number of Semesters between startDate and endDate |
NumberOfTrimestersUntil | Count the number of Trimesters between startDate and endDate |
NumberOfWeekendsUntil | Count the number of Weekends between startDate and endDate |
NumberOfWeeksUntil | Count the number of Weeks between startDate and endDate |
NumberOfWorkdaysUntil | Count the number of Workdays between startDate and endDate |
NumberOfYearsUntil | Count the number of years between startDate and endDate |
PreviousDay | Gets the DateOnly value of the day before |
PreviousHoliday |
Gets the DateOnly value of the previous holiday If you have a license for the Nager nuget package, this method will calculate the holidays based on the calendar in cultureInfo, otherwise it will simply skip weekends. |
PreviousMonth | Gets the DateOnly value of the month before |
PreviousWeek | Gets the DateOnly value of the week before |
PreviousWeekend | Gets the DateOnly value of the weekend before this date. If the given date is already a weekend, the previous weekend is returned. |
PreviousWorkday | Gets the DateOnly value of the previous working day |
PreviousYear | Gets the DateOnly value of the next year, first month, first day, time members are all zeroed (00:00:00) |
Split(DateOnlyRange, Int32) | Splits the given range of DateOnly into the given number of parts. |
Split(DateOnly, DateOnly, Int32) | Splits the given range of DateOnly into the given number of parts. |
Split(DateOnly, TimeSpan, Int32) | Splits the given range of DateOnly into the given number of parts. |
StartOfMonth | Returns a DateTime object representing the first day of the current month |
StartOfWeek | Returns a DateTime object representing the first weekday of the given Week |
Sub | Returns a new DateOnly that subtracts the value of the specified TimeSpan from the value of this instance |
ToDateOnly | Returns the DateTime as DateOnly |
ToDateTime | Returns a DateTime object with the time component set to 0 (00:00:00) |
ToSqlString | Converts a DateTime value to an SQL appropriate format (yyyy-MM-dd), independent of the current locale |
ToTimeOnly | Returns the DateTime as TimeOnly, stripping the date component |
TruncateTo | Truncates the precision of a DateTime object to the given precision |
TruncateToMonth | Truncates the precision of a DateOnly object to the month, day 1 |
TruncateToWeek | Truncates the precision of a DateOnly object to the week of the object, day is first day of week |
TruncateToYear | Truncates the precision of a DateOnly object to the year, day 1, month 1 |
Union | Calculates the union of two DateOnlyRanges. If the two ranges do not overlap, the result is an empty DateOnlyRange. Otherwise, the result is the DateOnlyRange that contains both ranges. |
Weeknumber | Tests if the time in the given DateTime object is midday (12:00:00.000) |
WeekOfYear | Returns the Week of the Year of this DateOnly object |
DaysInWeek | You'd never guess it, its the number of days in a week |