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
Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
