Method ChangeKind
ChangeKind(DateTime, DateTimeKind)
Returns a System.DateTime instance with the System.DateTime.Kind property set to the specified value, but otherwise representing the same time as original.
Declaration
public static DateTime ChangeKind(this DateTime value, DateTimeKind newKind)
Parameters
| Type | Name | Description |
|---|---|---|
| System.DateTime | value | The System.DateTime to use as the basis for the new value. |
| System.DateTimeKind | newKind | The System.DateTimeKind value to use for the new instance. |
Returns
| Type | Description |
|---|---|
| System.DateTime |
Remarks
If the newKind is the same as the kind property of value then the value of value is returned instead of a new instance.
This method does NOT convert between timezones, if the datetime provided is 20/03/2016 13:00:00 then that will be the same value returned in the new instance, only the System.DateTime.Kind propery is changed.