NullableTypes Class Library

DBNullConvert.ToNullableDateTime Method 

Converts an object value that is DBNull or System.DateTime to an equivalent NullableDateTime value.

[Visual Basic]
Public Shared Function ToNullableDateTime( _
   ByVal x As Object _
) As NullableDateTime
public static NullableDateTime ToNullableDateTime(
   object x


A value of DateTime type from either a DataRow Item value, a Parameters Item value or a IDataRecord GetValue returned value.

Return Value

Null if x is DBNull otherwise a NullableDateTime constructed from x.


Exception TypeCondition
ArgumentNullExceptionx is null.
InvalidCastExceptionx is neither DBNull or of type DateTime.

See Also

DBNullConvert Class | NullableTypes.HelperFunctions Namespace