EN
Il contenuto non è disponibile nella lingua di destinazione, ma solo in inglese.

VariantToDosDateTime function

Extracts a date and time value in Microsoft MS-DOS format from a VARIANT structure.

Syntax


HRESULT VariantToDosDateTime(
  _In_   REFVARIANT varIn,
  _Out_  WORD *pwDate,
  _Out_  WORD *pwTime
);

Parameters

varIn [in]

Type: REFVARIANT

Reference to a source VARIANT structure.

pwDate [out]

Type: WORD*

When this function returns, contains the extracted WORD that represents a MS-DOS date.

pwTime [out]

Type: WORD*

When this function returns, contains the extracted contains the extracted WORD that represents a MS-DOS time.

Return value

Type: HRESULT

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

Remarks

This helper function is used when the calling application expects a VARIANT to hold a datetime value.

If the source VARIANT is of type VT_DATE, this function extracts the datetime value.

If the source VARIANT is not of type VT_DATE, the function attempts to convert the value in the VARIANT structure into the right format. If a conversion is not possible, VariantToDosDateTime returns a failure code. See PropVariantChangeType for a list of possible conversions.

See DosDateTimeToVariantTime for more information about the formats of pwDate, pwTime, and the source datetime value.

Examples

The following example, to be included as part of a larger program, demonstrates how to use VariantToDosDateTime to access a datetime value in a VARIANT.


// VARIANT var;
// Assume variable var is initialize and valid.
// The application expects var to hold a VT_DATE value.

WORD wDate;
WORD wTime;

HRESULT hr = VariantToDosDateTime(var, &wDate, &wTime);

if (SUCCEEDED(hr))
{
    // wDate and wTime are now valid.
}

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

Library

Propsys.lib

DLL

Propsys.dll (version 6.0 or later)

See also

InitVariantFromDosDateTime
VariantToFileTime
PropVariantToFileTime
PropVariantChangeType

 

 

Aggiunte alla community

AGGIUNGI
Mostra:
© 2015 Microsoft