NullableTypes Class Library

NullConvert.From Method (NullableDateTime, String, String)

Converts the specified NullableDateTime value to an equivalent String value using a conventional String value to represent the Null value.

[Visual Basic]
Overloads Public Shared Function From( _
   ByVal x As NullableDateTime, _
   ByVal conventionalNullValue As String, _
   ByVal format As String _
) As String
public static string From(
   NullableDateTime x,
   string conventionalNullValue,
   string format


The NullableDateTime value to convert.
The String value that conventionally represent the Null value.
A string that specifies the return format of x if it is not Null.

Return Value

conventionalNullValue if x is Null otherwise the equivalent string of the Value of x formatted as specified by format.


If format is a null reference (Nothing in Visual Basic) or an empty string (""), general format specifier ("G") will be used.

The DateTimeFormatInfo for the current culture is used when applying fomatting.


Exception TypeCondition
FormatException The length of format is 1, and it is not one of the format specifier characters defined for DateTimeFormatInfo.


format does not contain a valid custom format pattern.

See Also

NullConvert Class | NullableTypes.HelperFunctions Namespace | NullConvert.From Overload List