Method ToDateTime
ToDateTime()
Converts value of this instance to date and time value.
Declaration
public virtual DateTime ToDateTime()
Returns
Type | Description |
---|---|
DateTime | Value of this instance as date and time. |
Remarks
This conversion is valid only for instances of TimestampValue, IntegerValue, LongValue or instances of StringValue containing valid representation of date and time.
For instances of IntegerValue and LongValue, the input value represents number of milliseconds since Unix Epoch (1970-01-01T00:00:00). For instances of StringValue, this operation is equivalent to calling ToDateTime(String) and supports the same date and time formats.
Exceptions
Type | Condition |
---|---|
InvalidCastException | If this instance is not TimestampValue, IntegerValue, LongValue or StringValue. |
FormatException | If this instance is StringValue and does not have valid representation of date and time. |