You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows 2000 Professional [desktop apps \| UWP apps]
req.target-min-winversvr
Windows 2000 Server [desktop apps \| UWP apps]
req.kmdf-ver
req.umdf-ver
req.ddi-compliance
req.unicode-ansi
req.idl
req.max-support
req.namespace
req.assembly
req.type-library
req.lib
Kernel32.lib
req.dll
Kernel32.dll
req.irql
targetos
Windows
req.typenames
req.redist
ms.custom
snippet-project
f1_keywords
GetSystemTime
sysinfoapi/GetSystemTime
dev_langs
c++
topic_type
APIRef
kbSyntax
api_type
DllExport
api_location
api-ms-win-core-sysinfo-l1-2-7.dll
api-ms-win-core-sysinfo-l1-2-6.dll
api-ms-win-core-sysinfo-l1-2-5.dll
api-ms-win-core-sysinfo-l1-2-4.dll
Kernel32.dll
API-MS-Win-Core-SysInfo-l1-1-0.dll
KernelBase.dll
API-MS-Win-Core-SysInfo-l1-2-0.dll
API-MS-Win-Core-SysInfo-l1-2-1.dll
API-MS-Win-Core-SysInfo-l1-2-2.dll
API-MS-Win-DownLevel-Kernel32-l1-1-0.dll
MinKernelBase.dll
API-MS-Win-Core-SysInfo-l1-2-3.dll
api_name
GetSystemTime
GetSystemTime function
-description
Retrieves the current system date and time in Coordinated Universal Time (UTC) format.
To retrieve the current system date and time in local time, use the GetLocalTime function.
-parameters
-param lpSystemTime [out]
A pointer to a
SYSTEMTIME structure to receive the current system date and time. The lpSystemTime parameter must not be NULL. Using NULL will result in an access violation.
-remarks
To set the current system date and time, use the SetSystemTime function.
Examples
#include<windows.h>
#include<stdio.h>voidmain()
{
SYSTEMTIME st, lt;
GetSystemTime(&st);
GetLocalTime(<);
printf("The system time is: %02d:%02d\n", st.wHour, st.wMinute);
printf(" The local time is: %02d:%02d\n", lt.wHour, lt.wMinute);
}
// Sample output
The system time is: 19:34
The local time is: 12:34
For more information about this example, see
SYSTEMTIME.