Class RelativeDate
Represents a date relative to some point in the client's timezone which can be evaluated during query execution.
public sealed class RelativeDate
- Inheritance
-
RelativeDate
- Inherited Members
Remarks
Evaluation applies calendar-month offsets, then working-day offsets, to the anchor before any day/time offset, regardless of the order of Add* calls.
Constructors
RelativeDate(Anchor, TimeSpan)
public RelativeDate(RelativeDate.Anchor anchor, TimeSpan offset)
Parameters
anchorRelativeDate.AnchoroffsetTimeSpan
Properties
Now
public static RelativeDate Now { get; }
Property Value
Today
public static RelativeDate Today { get; }
Property Value
Methods
Add(TimeSpan)
public RelativeDate Add(TimeSpan value)
Parameters
valueTimeSpan
Returns
AddDays(double)
public RelativeDate AddDays(double days)
Parameters
daysdouble
Returns
AddHours(double)
public RelativeDate AddHours(double hours)
Parameters
hoursdouble
Returns
AddMinutes(double)
public RelativeDate AddMinutes(double minutes)
Parameters
minutesdouble
Returns
AddMonths(int)
Add calendar months, clamping to the last day of the target month (like AddMonths(int)).
public RelativeDate AddMonths(int months)
Parameters
monthsint
Returns
AddSeconds(double)
public RelativeDate AddSeconds(double seconds)
Parameters
secondsdouble
Returns
AddWorkingDays(int)
Add working days, skipping Saturdays and Sundays: the accumulated steps move to the next (or previous) non-weekend day, preserving the time of day.
public RelativeDate AddWorkingDays(int days)
Parameters
daysint
Returns
Equals(object?)
Relative dates with the same anchor, months, working days and offset are equal, regardless of how they were built.
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
implicit operator DateOnly(RelativeDate)
public static implicit operator DateOnly(RelativeDate value)
Parameters
valueRelativeDate
Returns
implicit operator DateTime(RelativeDate)
public static implicit operator DateTime(RelativeDate value)
Parameters
valueRelativeDate
Returns
implicit operator DateTimeOffset(RelativeDate)
public static implicit operator DateTimeOffset(RelativeDate value)
Parameters
valueRelativeDate