VarToDateTime Function
VarToDateTime
converts a Variant
to a TDateTime
. If the Variant
cannot be converted to varDate
, the function
reports runtime error 15
(EVariantError
).
VarToDateTime
is a real function.
Assigning a Variant
to a
TDateTime
variable does not work. Because
TDateTime
is a floating-point type, the assignment
would try to convert the Variant
to a
varDouble
, not a varDate
.
VarToDateTime
eventually calls the Windows API
function VariantChangeTypeEx
to parse the string
and interpret the date and time. See the Platform SDK documentation
for details. VarToDateTime
accepts many more
formats than StrToDateTime
.