VarFormat Function

Formats a variant into string form by parsing a format string.

HRESULT VarFormat(
  LPVARIANT pvarIn,
  LPOLESTR pbstrFormat,
  int   iFirstDay,
  int   iFirstWeek,
  ULONG dwFlags,
  BSTR *pbstrOut
);
pvarIn

[in] The variant containing the value to format.

pbstrFormat

[in] Points to the format string for example "mm-dd-yy".

iFirstDay

[in] First day of the week, 0 = system default, 1 = Monday, 2 = Tuesday etc.

iFirstWeek

[in] First week of the year. The following table describes the values for iFirstWeek:

iFirstWeek Values

Meaning

0

The system default

1

The first week contains January 1st.

2

The larger half (four days) of the first week is in the current year.

3

The first week has seven days.

dwFlags

[in] Flags that control the formatting process. The only flags that can be set are VAR_CALENDAR_HIJRI or VAR_FORMAT_NOSUBSTITUTE.

pbstrOut

[out] Points to the formatted string that represents the variant.

The function returns one of the following:

Return value

Meaning

S_OK

Success.

E_INVALIDARG

One or more of the arguments is invalid.

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

Show:
© 2014 Microsoft. All rights reserved.