Function Convert Values Class

CDateIgnErr

"Convert To Date Ignore Errors" Attempt to convert vValue to a Date value. Return vValue as a Date value if the conversion was successful. Return the Date represented by the number 0 (zero) if vValue could not be converted to a Date.

Signature (Visual Basic / VBA)

Public Function CDateIgnErr( _
    ByVal vValue As Variant _
    ) As Date

Code Example

    CDateIgnErr(-1) = #12/29/1899#
    CDateIgnErr(0) = #12/30/1899#
    CDateIgnErr(1) = #12/31/1899#
    CDateIgnErr(1E300) = #12/30/1899#
    CDateIgnErr("1") = #12/31/1899#
    CDateIgnErr("0") = #12/30/1899#
    CDateIgnErr("Word") = #12/30/1899#
    CDateIgnErr("1/1/2001") = #1/1/2001#
    CDateIgnErr(#1/1/2001#) = #1/1/2001#
    CDateIgnErr("Jan 10 1965") = #1/10/1965#

Parameters

Parameter Description
vValue The value which will be converted to Date and returned (if conversion is possible). Conversion is not possible if vValue is Null, an Error, an Object, a non-numeric String, or a numeric value out of the range allowed for this data type.

Notes & Version History

Note This function is the same as CVDateIgnErr , except this one uses CDate to perform the conversion and that one uses CVDate to perform the conversion.