Click or drag to resize

DayMinusWeeks Method

Returns the Day that comes the specified numberOfWeeks before this Day in the calendar.

Namespace:  DegreeDays.Time
Assembly:  DegreeDays (in DegreeDays.dll) Version: 1.3
Syntax
public Day MinusWeeks(
	int numberOfWeeks
)

Parameters

numberOfWeeks
Type: SystemInt32
The number of weeks to subtract from this Day. Can be positive (to go backwards in time), zero, or negative (to go forwards in time).

Return Value

Type: Day
A Day representing the result of the operation.
Exceptions
ExceptionCondition
OverflowExceptionIn the unlikely event of this method requiring a Day with a year less than 1 or greater than 9999.
Remarks

This will happily cross the borders between months and years, and it will always ensure that the returned result is a valid Day, unless it is outside the range allowed by Day (0001-01-01 to 9999-12-31 inclusive), in which case it will throw an OverflowException.

For example 2020-08-07 (a Friday) minus 2 weeks would give a result of 2020-07-24 (also a Friday).

Day is immutable, so calling this method will not change this Day.

See Also