InitVariantFromDosDateTime function (propvarutil.h)

Initializes a VARIANT structure with a date and time given in the format used by Microsoft MS-DOS. The date and time values are converted to the format used to store date and time in a VARIANT.

Syntax

HRESULT InitVariantFromDosDateTime(
  [in]  WORD    wDate,
  [in]  WORD    wTime,
  [out] VARIANT *pvar
);

Parameters

[in] wDate

Type: WORD

WORD value that represents an MS-DOS date. See DosDateTimeToVariantTime for more information about this format.

[in] wTime

Type: WORD

WORD value that represents an MS-DOS time. See DosDateTimeToVariantTime for more information about this format.

[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.

See DosDateTimeToVariantTime for more information about the formats of wDate, wTime, and of the resulting variant date.

This is an inline function, with its source code provided in the header. It is not included in any .dll or .lib file.

Examples

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

// WORD wDate, wTime;
// Assume variables wDate and wTime are initialized and valid.
VARIANT var;

HRESULT hr = InitVariantFromDosDateTime(wDate, wTime, &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
Redistributable Windows Desktop Search (WDS) 3.0

See also

InitPropVariantFromFileTime

InitVariantFromFileTime

VariantToDosDateTime

VariantToFileTime