---
name: "VarFormatDateTime"
section: "3w"
platform: "linux"
package: "libwine-dev"
version: "1.4.1-4"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/VarFormatDateTime"
---

# VarFormatDateTime(3w)

## NAME

**VarFormatDateTime** (OLEAUT32.97)

## SYNOPSIS

HRESULT VarFormatDateTime\
  (\
   LPVARIANT *pVarIn*,\
   INT       *nFormat*,\
   ULONG     *dwFlags*,\
   BSTR\*     *pbstrOut*\
  )

## DESCRIPTION

Format a variant value as a date and/or time.

## PARAMS

*pVarIn* **\[In\]**  Variant to format.

*nFormat* **\[In\]**  Format type (see notes).

*dwFlags* **\[In\]**  Flags for the format (**VAR\_** flags from **"oleauto.h"**).

*pbstrOut* **\[Out\]**  Destination for formatted string.

## RETURNS

**Success:** **S\_OK**. *pbstrOut* contains the formatted value.

**Failure:** **E\_INVALIDARG**, if any parameter is invalid. **E\_OUTOFMEMORY**, if enough memory cannot be allocated. **DISP\_E\_TYPEMISMATCH**, if the variant cannot be formatted.

## NOTES

This function uses **LOCALE\_USER\_DEFAULT** when determining the date format characters to use. Possible values for the *nFormat* parameter are: \
\
  Value  Meaning\
\
  \-----  -------\
\
    0    General date format\
\
    1    Long date format\
\
    2    Short date format\
\
    3    Long time format\
\
    4    Short time format

## IMPLEMENTATION

Declared in **"oleauto.h"**.

Implemented in **"dlls/oleaut32/varformat.c"**.

Debug channel **"variant"**.
