SWbemDateTime.SetFileTime method

The SetFileTime method of the SWbemDateTime object converts a date in the string FILETIME format to the CIM datetime format.

The FILETIME format is a 64-bit datetime structure that represents the number of 100-nanosecond units since the beginning of January 1, 1601. Windows Management Instrumentation (WMI) treats FILETIME values as string representations of unsigned 64-bit numbers.

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


SWbemDateTime.SetFileTime( _
  ByVal strFileTime, _
  [ ByVal bIsLocal ] _


strFileTime [in]

FILETIME value used to set the object.

bIsLocal [in, optional]

If TRUE, strFileTime is interpreted as a local time. The Coordinated Universal Time (UTC) property contains the local time converted to the correct UTC offset. When bIsLocal is FALSE, then strFileTime is converted directly into a UTC value with an offset of 0 (zero).

Return value

This method does not return a value.

Error codes

After completing the SetFileTime method, the Err object may contain the error code in the following table.

Error (Name/Dec/Hex)Meaning
2147749921 (0x80041021)

The format of strFileTime is not valid.


After a successful call to SetFileTime, the datetime value is always interpreted as an absolute (datetime) value, and IsInterval is set to FALSE.


For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.

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


Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Type library




See also




© 2014 Microsoft