Function Coerce Make Class

CoerceToDateFast

"Coerce String To Date (Fast)" Return the Date value whose in-memory representation is the same as the first eight characters in string vString. Similar to the CVD function in earlier versions of Microsoft Basic except that the value is returned as Date instead of a Double. Faster version of the CoerceToDate function which has restrictive argument types (to avoid argument fix-up overhead).

Signature (Visual Basic / VBA)

Public Function CoerceToDateFast( _
    ByVal vString As String _
    ) As Date

Code Example

    CoerceToDateFast(Chr$(0) + Chr$(0) + Chr$(0) + Chr$(0) + Chr$(43) + Chr$(225) + Chr$(64)) = #4/5/1996#

Parameters

Parameter Description
vString The string whose first eight characters are to be interpreted as a Date value.

Notes & Version History

Note Function does NOT generate an error if vString less than or greater than eight characters long.
Note If vString is more than eight characters long, the leftmost eight characters are coerced to a Date value.
Note This function first converts the string from Unicode to the default code page of the system.
v1.3 Change Removed 16-bit support from this function.