Method Create
Create(DateTime, DateTime)
Creates a new DateTimeRange instance from two dates, using the earliest date as the start value.
Declaration
public static DateTimeRange Create(DateTime dateTime1, DateTime dateTime2)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | dateTime1 | A System.DateTime instance to use for the DateTimeRange. |
System.DateTime | dateTime2 | A System.DateTime instance to use for the DateTimeRange. |
Returns
Type | Description |
---|---|
DateTimeRange | A new DateTimeRange using the two System.DateTime values provided. |
Remarks
This method is different to the DateTimeRange(DateTime, DateTime) constructor as it will not throw if dateTime1
is greater than dateTime2
.
Instead, the earliest date is used for the Start and the later value for End.