DateTimeToRangeExtensions Class
Namespace: PTS
Assembly: PTS.Modules.DateTimeRangeComponent.dll
Syntax
public static class DateTimeToRangeExtensions
Inheritance
System.Object
DateTimeToRangeExtensions
Methods
ToDayCount(DateTime, DateTime)
Declaration
public static int ToDayCount(this DateTime from, DateTime until)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | from | |
System.DateTime | until |
Returns
Type | Description |
---|---|
System.Int32 |
ToDayRange(DateTime)
Declaration
public static DateTimeRange ToDayRange(this DateTime dateTime)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dateTime |
Returns
Type | Description |
---|---|
DateTimeRange |
ToHourRange(DateTime)
Declaration
public static DateTimeRange ToHourRange(this DateTime dateTime)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dateTime |
Returns
Type | Description |
---|---|
DateTimeRange |
ToMonthCalendarRange(DateTime, DayOfWeek)
Gets the calendar month range.
Declaration
public static DateTimeRange ToMonthCalendarRange(this DateTime yearAndMonth, DayOfWeek firstDayOfWeek = DayOfWeek.Monday)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | yearAndMonth | The year and month. |
System.DayOfWeek | firstDayOfWeek | The first day of week. |
Returns
Type | Description |
---|---|
DateTimeRange |
ToMonthRange(DateTime)
Declaration
public static DateTimeRange ToMonthRange(this DateTime dateTime)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dateTime |
Returns
Type | Description |
---|---|
DateTimeRange |
ToWeekRange(DateTime, Boolean)
Gets the week DateTime range.
Declaration
public static DateTimeRange ToWeekRange(this DateTime dateTime, bool weekStartsOnMonday = false)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dateTime | The DateTime |
System.Boolean | weekStartsOnMonday | Whether the week starts on Monday or not. |
Returns
Type | Description |
---|---|
DateTimeRange |
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()