• Home
  • API Documentation
Show / Hide Table of Contents
  • TimeyWimey
    • DateTimeExtensions
      • ChangeKind
      • IsFuture
      • IsPast
      • TruncateToHours
      • TruncateToMinutes
      • TruncateToSeconds
    • DateTimeOffsetExtensions
      • IsFuture
      • IsPast
      • TruncateToHours
      • TruncateToMinutes
      • TruncateToSeconds
    • DateTimeRange
      • CompareTo
      • Contains
      • Create
      • DateTimeRange
      • End
      • EndAt
      • Equality
      • Equals
      • GetHashCode
      • GreaterThan
      • Inequality
      • Length
      • LessThan
      • Overlaps
      • Start
      • StartAt
    • NumberToTimespanExtensions
      • Days
      • Hours
      • Milliseconds
      • Minutes
      • Seconds
    • TimeSpans
      • EightHours
      • EightMilliseconds
      • FifteenMilliseconds
      • FifteenMinutes
      • FifteenSeconds
      • FiveDays
      • FiveHours
      • FiveHundredMilliseconds
      • FiveMilliseconds
      • FiveMinutes
      • FiveSeconds
      • FortyFiveMinutes
      • FortyFiveSeconds
      • FourteenDays
      • NinetyDays
      • OneDay
      • OneHour
      • OneHundredAndTwentyDays
      • OneHundredMilliseconds
      • OneMillisecond
      • OneMinute
      • OneSecond
      • SevenDays
      • SixteenMilliseconds
      • SixtyDays
      • TenHours
      • TenMilliseconds
      • TenMinutes
      • TenSeconds
      • ThirtyDays
      • ThirtyMinutes
      • ThirtyOneDays
      • ThirtySeconds
      • ThreeDays
      • ThreeHours
      • ThreeHundredAndSixtyFiveDays
      • ThreeMinutes
      • ThreeSeconds
      • TwelveHours
      • TwentyFourHours
      • TwentyMilliseconds
      • TwentyMinutes
      • TwentySeconds
      • TwoDays
      • TwoHours
      • TwoHundredAndFiftyMilliseconds
      • TwoMinutes
      • TwoSeconds
    • UnixTime
      • ToDateTime
      • ToDateTimeOffset
      • ToUnixTimestamp
      • UnixEpoch
      • UnixEpochDateTimeOffset
  • TimeyWimey.Abstractions
    • CachingClock
      • CachingClock
      • Dispose
      • Now
    • ClockBase
      • Adjusted
      • Now
      • OnAdjusted
    • IClock
      • Adjusted
      • Now
    • MockClock
      • Now
      • SetTime
    • SystemClock
      • Now
  • TimeyWimey.Tests
    • NumberToTimespanExtensions
      • DoubleToDays_InitialisesTimeSpanCorrectly
      • DoubleToHours_InitialisesTimeSpanCorrectly
      • DoubleToMilliseconds_InitialisesTimeSpanCorrectly
      • DoubleToMinutes_InitialisesTimeSpanCorrectly
      • DoubleToSeconds_InitialisesTimeSpanCorrectly
      • FloatToDays_InitialisesTimeSpanCorrectly
      • FloatToHours_InitialisesTimeSpanCorrectly
      • FloatToMilliseconds_InitialisesTimeSpanCorrectly
      • FloatToMinutes_InitialisesTimeSpanCorrectly
      • FloatToSeconds_InitialisesTimeSpanCorrectly
      • IntegerToDays_InitialisesTimeSpanCorrectly
      • IntegerToHours_InitialisesTimeSpanCorrectly
      • IntegerToMilliseconds_InitialisesTimeSpanCorrectly
      • IntegerToMinutes_InitialisesTimeSpanCorrectly
      • IntegerToSeconds_InitialisesTimeSpanCorrectly
      • LongToDays_InitialisesTimeSpanCorrectly
      • LongToHours_InitialisesTimeSpanCorrectly
      • LongToMilliseconds_InitialisesTimeSpanCorrectly
      • LongToMinutes_InitialisesTimeSpanCorrectly
      • LongToSeconds_InitialisesTimeSpanCorrectly

Struct DateTimeRange

Represents a span of time between specified by a start and end date.

Implements
System.IEquatable<DateTimeRange>
System.IComparable<DateTimeRange>
Inherited Members
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
Namespace: TimeyWimey
Assembly: cs.temp.dll.dll
Syntax
public struct DateTimeRange : IEquatable<DateTimeRange>, IComparable<DateTimeRange>
Remarks

DateTimeRange instances are compared and sorted by their Start property, if the values are equal then they are compared by their End property. Values with the same start and end values are equal.

Constructors

Name Description
DateTimeRange(DateTime, DateTime)

Creates a new DateTimeRange instance from two System.DateTime values.

Properties

Name Description
End

Returns the date and time this date range ends at.

Length

Returns the length of the range as a System.TimeSpan instance.

Start

Returns the date and time this date range starts at.

Methods

Name Description
CompareTo(DateTimeRange)

Compares this instance with another DateTimeRange instance. If the instances are equal, returns zero. If this instance is less than other then -1 one is returned. If this instance is greater than other then 1 one is returned.

Contains(DateTime)

Returns true if the date and time specified by moment falls within the range specified by this instance, otherwise false.

Contains(DateTimeRange)

Returns true if both the start and end properties of other fall within this date range, or if other is equal to this date range.

Create(DateTime, DateTime)

Creates a new DateTimeRange instance from two dates, using the earliest date as the start value.

EndAt(DateTime)

Creates a new DateTimeRange instance using the Start value of this instance and a new value for End.

Equals(Object)

Returns true if two instances are considered equal. Equality is checked by comparing the Start and End properties.

Equals(DateTimeRange)

Returns true if two instances are considered equal. Equality is checked by comparing the Start and End properties.

GetHashCode()

Returns a hash code based on the Start and End values.

Overlaps(DateTimeRange)

Returns true if any part of the range specified by this instance overlaps with the range specified by other.

StartAt(DateTime)

Creates a new DateTimeRange instance using the End value of this instance and a new value for Start.

Operators

Name Description
Equality(DateTimeRange, DateTimeRange)

Peforms an equality check, equivalent to calling Equals(DateTimeRange).

GreaterThan(DateTimeRange, DateTimeRange)

Peforms an comparison, equivalent to; CompareTo(DateTimeRange) > 0.

Inequality(DateTimeRange, DateTimeRange)

Peforms an inequality check, equivalent to calling !Equals(DateTimeRange).

LessThan(DateTimeRange, DateTimeRange)

Peforms an comparison, equivalent to; CompareTo(DateTimeRange) < 0.

Back to top Copyright (c) 2017 Troy Willmot