SetDateTime method of the Win32_OperatingSystem class

The SetDateTime WMI class method sets the current system time on the computer.

This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see Calling a Method.

Syntax

uint32 SetDateTime(
  [in] datetime LocalDatetime
);

Parameters

LocalDatetime [in]

Value of the current time.

Return value

Returns zero (0) to indicate success. Any other number indicates an error. For error codes, see WMI Error Constants or WbemErrorEnum. For general HRESULT values, see System Error Codes.

Success (0)

Other (1 4294967295)

Remarks

The calling process must have the SE_SYSTEMTIME_NAME privilege.

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Namespace
Root\CIMV2
MOF
CIMWin32.mof
DLL
CIMWin32.dll

See also

Operating System Classes

Win32_OperatingSystem

WMI Tasks: Desktop Management