VarBstrFromDate function (oleauto.h)

Converts a date value to a BSTR value.

Syntax

HRESULT VarBstrFromDate(
  [in]  DATE  dateIn,
  [in]  LCID  lcid,
  [in]  ULONG dwFlags,
  [out] BSTR  *pbstrOut
);

Parameters

[in] dateIn

The value to convert.

[in] lcid

The locale identifier.

[in] dwFlags

One or more of the following flags.

Value Meaning
LOCALE_NOUSEROVERRIDE
Uses the system default locale settings, rather than custom locale settings.
VAR_CALENDAR_HIJRI
If set then the Hijri calendar is used. Otherwise the calendar set in the control panel is used.
VAR_CALENDAR_THAI
If set then the Buddhist year is used.
VAR_CALENDAR_GREGORIAN
If set the Gregorian year is used.
VAR_FOURDIGITYEARS
Use 4-digit years instead of 2-digit years.
VAR_TIMEVALUEONLY
Omits the date portion of a VT_DATE and returns only the time. Applies to conversions to or from dates.
VAR_DATEVALUEONLY
Omits the time portion of a VT_DATE and returns only the date. Applies to conversions to or from dates.

[out] pbstrOut

The resulting value.

Return value

This function can return one of these values.

Return code Description
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 not valid.
E_OUTOFMEMORY
Insufficient memory to complete the operation.

Requirements

Requirement Value
Target Platform Windows
Header oleauto.h
Library OleAut32.lib
DLL OleAut32.dll