GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Skip to Ask Learn chat experience
  • Download Microsoft Edge

This view

  • Original page
  • New address

GeezerVison is showing learn.microsoft.com — GetSystemTime function (sysinfoapi.h) - Win32 apps

Read in English Edit

Note

Access to this page requires authorization. You can try signing in or changing directories.

Access to this page requires authorization. You can try changing directories.

GetSystemTime function (sysinfoapi.h)

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.

Syntax

VOID GetSystemTime(
  [out] LPSYSTEMTIME lpSystemTime
);

Parameters

[out] lpSystemTime

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.

Return value

None

Remarks

To set the current system date and time, use the SetSystemTime function.

Examples

#include <windows.h>
#include <stdio.h>

void main()
{
    SYSTEMTIME st, lt;
    
    GetSystemTime(&st);
    GetLocalTime(&lt);
    
    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.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header sysinfoapi.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

GetLocalTime

GetSystemTimeAdjustment

GetSystemTimeAsFileTime

SYSTEMTIME

SetSystemTime

System Time

Time Functions


Feedback

Was this page helpful?

No

Additional resources


  • Last updated on 2024-02-22
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.