InitVariantFromFileTime function (propvarutil.h)

Initializes a VARIANT structure with the contents of a FILETIME structure.

Syntax

PSSTDAPI InitVariantFromFileTime(
  [in]  const FILETIME *pft,
  [out] VARIANT        *pvar
);

Parameters

[in] pft

Type: const FILETIME*

Pointer to date and time information stored in a FILETIME structure.

[out] pvar

Type: VARIANT*

When this function returns, contains the initialized VARIANT structure.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

Creates a VT_DATE variant.

Examples

The following example, to be included as part of a larger program, demonstrates how to use InitVariantFromFileTime.

VARIANT var;
FILETIME ft;

GetSystemTimeAsFileTime(&ft);

HRESULT hr = InitVariantFromFileTime(&ft, &var);

if (SUCCEEDED(hr))
{
    // var now is valid and has type VT_DATE.
    VariantClear(&propvar);
}

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 with SP1 [desktop apps only]
Target Platform Windows
Header propvarutil.h
Library Propsys.lib
DLL Propsys.dll (version 6.0 or later)
Redistributable Windows Desktop Search (WDS) 3.0

See also

GetSystemTimeAsFileTime

InitPropVariantFromFileTime

VariantToFileTime