VarFormatDateTime function (oleauto.h)

Formats a variant containing named date and time information into a string.

Syntax

HRESULT VarFormatDateTime(
  [in]  LPVARIANT pvarIn,
  [in]  int       iNamedFormat,
  [in]  ULONG     dwFlags,
  [out] BSTR      *pbstrOut
);

Parameters

[in] pvarIn

The variant containing the value to format.

[in] iNamedFormat

The named date formats are as follows.

Value Meaning
0
General date
1
Long date
2
Short date
3
Long time
4
Short time

[in] dwFlags

VAR_CALENDAR_HIJRI is the only flag that can be set.

[out] pbstrOut

Receives the formatted string that represents the variant.

Return value

This function can return one of these values.

Return code Description
S_OK
Success.
E_INVALIDARG
One or more of the arguments is not valid.

Remarks

This function uses the user's default locale while calling VarTokenizeFormatString and VarFormatFromTokens.

Requirements

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

See also

Formatting Routines

VarFormatFromTokens

VarTokenizeFormatString