Skip to main content

DateTimeRange Members

A structure that specifies a time interval with the [start, end). mathematical formula.

Constructors

Name Description
DateTimeRange(DateTimeRange) Initializes a new instance of the DateTimeRange class with specified settings.
DateTimeRange(DateTime, DateTime) Initializes a new instance of the DateTimeRange class with specified settings.
DateTimeRange(DateTime, TimeSpan) Initializes a new instance of the DateTimeRange class with specified settings.

Properties

Name Description
Duration Gets the duration of the DateTimeRange.
Empty static Gets an empty datetime range.
End Gets the end date and time of the datetime range.
IsEmpty Gets whether the current datetime range is empty.
IsValid Gets whether the current datetime range is valid.
Start Gets the start date and time of the datetime range.
Today static Gets the current calendar day.

Methods

Name Description
Contains(DateTimeRange) Checks whether the range contains the specified date-time value.
Contains(DateTime, Boolean) Checks whether the current range contains the specified date-time range.
Equals(DateTimeRange) Defines whether the specified DateTimeRange is equal to the current DateTimeRange instance.
Equals(Object, Object) static Determines whether the specified object instances are considered equal. Inherited from Object.
Equals(Object) Defines whether the specified object is equal to the current DateTimeRange instance.
GetHashCode() Gets the hash code (a number) that corresponds to the value of the current TimeInterval object.
GetType() Gets the Type of the current instance. Inherited from Object.
Intersect(DateTimeRange, DateTimeRange, Boolean) static Checks whether the date time range intersects with two specified ranges.
Intersect(DateTimeRange, Boolean) Computes the intersection of the current range with the specified range.
IntersectsWith(DateTimeRange, DateTimeRange, Boolean) static Computes the intersection of the specified ranges.
IntersectsWith(DateTimeRange, Boolean) Checks whether the time range intersects with the specified range.
ReferenceEquals(Object, Object) static Determines whether the specified Object instances are the same instance. Inherited from Object.
ToString() Returns the textual representation of the datetime range.
ToString(IFormatProvider) Returns a culture-specific string representation of the time range.
ToString(String, IFormatProvider) Returns a string that represents the range. The return string uses the specified format string to format the result in a culture-specific template.
TryParse(String, CultureInfo, out DateTimeRange) static Tries to parse the specified string and convert it into the date-time range.
Union(DateTimeRange, DateTimeRange) static Computes the union of the current range and the specified range.
Union(DateTimeRange) Computes the union of the specified ranges.

Operators

Name Description
Equality(DateTimeRange, DateTimeRange) static Determines whether two specified ranges have the same value.
Inequality(DateTimeRange, DateTimeRange) static Determines whether two specified ranges have different values.
See Also