<-- Previous || Up || Next -->

Coerce To Date Function
Coerce Make Class

Public Function CoerceToDate( _
    ByVal vString As Variant _
    ) As Variant

"Coerce String To Date"
Return the Date value whose in-memory representation is the same as the first eight characters in string vString.
Same as the CVD function in earlier versions of Microsoft Basic except that the value is returned as Date instead of a Double.
Inverse of the MakeDate function.

Examples:
    CoerceToDate(Chr$(0) + Chr$(0) + Chr$(0) + Chr$(0) + Chr$(43) + Chr$(225) + Chr$(64)) = #4/5/1996#
    IsNull(CoerceToDate(Null)) = True
See also:
    CoerceToDateFast Function
    MakeDate Function
    CoerceToVarType Function
    CoerceToDouble Function
vString: The string whose first 8 (eight) characters are to be interpreted as a Date value. Function returns Null if vString is Null or cannot be fixed up to a String.

Note: Function generates the Visual Basic Error "Illegal Function Call" if vString is less than 8 characters long (the size of a Date value).
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.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.