DateTimeRangeHelper Class
Namespace: PTS
Assembly: PTS.Modules.DateTimeRangeComponent.dll
Syntax
public static class DateTimeRangeHelperInheritance
Methods
IsInRange(DateTimeRange, DateTime, Boolean)
Determines whether given DateTime is in range.
Declaration
public static bool IsInRange(this DateTimeRange range, DateTime time, bool inclusive = false)Parameters
| Type | Name | Description | 
|---|---|---|
| DateTimeRange | range | Bounding date range to check against. | 
| System.DateTime | time | The time to check wether it belongs to specified date range. | 
| System.Boolean | inclusive | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | If datetime is within range then  | 
IsOverlapping(DateTimeRange, DateTimeRange)
Determines whether the two dateranges are overlapping.
Declaration
public static bool IsOverlapping(this DateTimeRange date1, DateTimeRange date2)Parameters
| Type | Name | Description | 
|---|---|---|
| DateTimeRange | date1 | The first date. | 
| DateTimeRange | date2 | The second date. | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
 | 
ToDayCount(DateTimeRange)
Gets the number of whole days for for give date range.
Declaration
public static int ToDayCount(this DateTimeRange range)Parameters
| Type | Name | Description | 
|---|---|---|
| DateTimeRange | range | The date range to get the day count for. | 
Returns
| Type | Description | 
|---|---|
| System.Int32 | Whole numer representing the number of days in range. | 
ToDays(DateTimeRange)
Gets collection of DateTime values representing individual days in range.
Declaration
public static List<DateTime> ToDays(this DateTimeRange range)Parameters
| Type | Name | Description | 
|---|---|---|
| DateTimeRange | range | The range to get the DateTime day representations for. | 
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.List<System.DateTime> | Collection of DateTime values representing individual days in range | 
ToHourCount(DateTimeRange)
Gets the whole number representing the count of hours in range.
Declaration
public static int ToHourCount(this DateTimeRange range)Parameters
| Type | Name | Description | 
|---|---|---|
| DateTimeRange | range | The range to get the hour count for. | 
Returns
| Type | Description | 
|---|---|
| System.Int32 | The whole number representing the count of hours in range | 
ToMinuteCount(DateTimeRange)
Gets the whole number representing the count of minutes in range.
Declaration
public static int ToMinuteCount(this DateTimeRange range)Parameters
| Type | Name | Description | 
|---|---|---|
| DateTimeRange | range | The range to get the minute count for. | 
Returns
| Type | Description | 
|---|---|
| System.Int32 | The whole number representing the count of minutes in range | 
ToMonths(DateTimeRange)
Gets collection of DateTime values representing individual months in range.
Declaration
public static List<DateTime> ToMonths(this DateTimeRange range)Parameters
| Type | Name | Description | 
|---|---|---|
| DateTimeRange | range | The range to get the DateTime month representations for. | 
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.List<System.DateTime> | Collection of DateTime values representing individual months in range | 
ToSecondCount(DateTimeRange)
Gets the whole number representing the count of seconds in range.
Declaration
public static int ToSecondCount(this DateTimeRange range)Parameters
| Type | Name | Description | 
|---|---|---|
| DateTimeRange | range | The range to get the second count for. | 
Returns
| Type | Description | 
|---|---|
| System.Int32 | The whole number representing the count of seconds in range | 
ToTimespan(DateTimeRange)
Gets the timespan between dates in range.
Declaration
public static TimeSpan ToTimespan(this DateTimeRange range)Parameters
| Type | Name | Description | 
|---|---|---|
| DateTimeRange | range | The range to get the timespan for. | 
Returns
| Type | Description | 
|---|---|
| System.TimeSpan | The timespan between dates in range. | 
ToWeeks(DateTimeRange, Boolean)
Gets collection of DateTime values representing individual weeks in range.
Declaration
public static List<DateTime> ToWeeks(this DateTimeRange range, bool weekStartsOnMonday = false)Parameters
| Type | Name | Description | 
|---|---|---|
| DateTimeRange | range | The range to get the DateTime week representations for. | 
| System.Boolean | weekStartsOnMonday | 
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.List<System.DateTime> | Collection of DateTime values representing individual weekss in range |