InitVariantFromDosDateTime function

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

wDate [in]

Type: WORD

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

wTime [in]

Type: WORD

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

pvar [out]

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

Minimum supported client

Windows XP with SP2, Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 with SP1 [desktop apps only]

Redistributable

Windows Desktop Search (WDS) 3.0

Header

Propvarutil.h

See also

VariantToDosDateTime
VariantToFileTime
InitVariantFromFileTime
InitPropVariantFromFileTime

 

 

Show: