Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library

VarDateFromStr Function

Converts an OLECHAR string to a date value.

HRESULT VarDateFromStr(
   [in]  OLECHAR        *strIn,
   [in]  LCID           lcid,
   [in]  unsigned long  dwFlags,
   [out] DATE           *pdateOut
);

strIn

[in] The value to coerce.

lcid

[in] For conversions from string and VT_DISPATCH input, the LCID to use for the conversion. This parameter allows locale-specific parsing to occur. For a list of LCIDs, see Supporting Multiple National Languages and Exposing ActiveX Objects.

dwFlags

[in] One or more of the following flags:

Flag

Description

LOCALE_NOUSEROVERRIDE

Uses the system default locale settings, rather than customized locale settings.

VAR_CALENDAR_HJRI

If set then the Hijri calendar is used. Otherwise the calendar sent in the control panel is used.

VAR_DATEVALUEONLY

Omits the time portion of a VT_DATE and returns only the date. Applies to conversions to or from dates. Not used for VariantChangeType and VariantChangeTypeEx.

VAR_TIMEVALUEONLY

Omits the date portion of a VT_DATE and returns only the time. Applies to conversions to or from dates. Not used for VariantChangeType and VariantChangeTypeEx.

pdateOut

[out] Points to the coerced value.

The return value obtained from the returned HRESULT is one of the following.

Value

Meaning

S_OK

Success.

DISP_E_BADVARTYPE

The input parameter is not a valid type of variant.

DISP_E_OVERFLOW

The data pointed to by the output parameter does not fit in the destination type.

DISP_E_TYPEMISMATCH

The argument could not be coerced to the specified type.

E_INVALIDARG

One of the arguments is invalid.

E_OUTOFMEMORY

Memory could not be allocated for the conversion.

For input dates with the year between 194707 and 206607 (inclusive), VarDateFromStr will truncate the output value and generate a valid date, with the year in the range from 0 through 9999. In this case, the function returns S_OK.

Show:
© 2015 Microsoft