Function Comparisons Class

CanBeDate

Determine if the argument can be converted to a Date value.

Signature (Visual Basic / VBA)

Public Function CanBeDate( _
    ByVal vValue As Variant _
    ) As Boolean

Code Example

    CanBeDate(#12/31/95#) = True
    CanBeDate("Jan 1 1945") = True
    CanBeDate("3/45/67") = False
    CanBeDate(34) = True
    CanBeDate(1234.56) = True
    CanBeDate("1") = True

Parameters

Parameter Description
vValue The argument which is checked to see if it can be converted to a Date value. Function returns True if vValue contains a numeric value, a date value, a numeric string value, or a date string value which is within the range of values supported by the Date data type. Function returns False otherwise, such as if vValue is out-of-range, Null, an error, or an object pointer.