SWbemDateTime.GetVarDate method

The GetVarDate method of the SWbemDateTime object converts a date and time value in the CIM DATETIME format to the VT_DATE format.

The VT_DATE format is an automation variant DATETIME value that Visual Basic and ActiveX use.

For an explanation of this syntax, see Document Conventions for the Scripting API.

Syntax

vdate = .GetVarDate( _
  [ ByVal bIsLocal ] _
)

Parameters

bIsLocal [in, optional]

Indicates whether the returned value is interpreted as local time. The Coordinated Universal Time (UTC) property contains the local time converted to the correct UTC offset. If the value is FALSE, then the value is interpreted as UTC with a zero (0) offset.

Return value

The date and time value in the VT_DATE format.

Remarks

VT_DATE and FILETIME values cannot contain wildcard fields.

The GetVarDate method fails (wbemErrFailed) if any of the following properties are FALSE:

On successful return from SetVarDate, all of these properties are set to TRUE.

After a successful call to SetVarDate, the DATETIME value is always interpreted as an absolute DATETIME value instead of an interval, and the IsInterval is set to FALSE.

If IsInterval is set to TRUE, then a call to GetVarDate results in the wbemErrFailed error.

Some loss of precision occurs when you call GetVarDate, because datetime values have a one microsecond ( s) resolution, and VT_DATE values have a 500 millisecond resolution.

Examples

For examples of using the SWbemDateTime object to convert CIM DATETIME values to and from either the FILETIME or the VT_DATE format, see WMI Tasks: Dates and Times. For a description of the CIM DATETIME format, see Date and Time Format.

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
Wbemdisp.h
Type library
Wbemdisp.tlb
DLL
Wbemdisp.dll
CLSID
CLSID_SWbemDateTime
IID
IID_ISWbemDateTime

See also

SWbemDateTime.GetFileTime

SWbemDateTime

DATETIME