Created
December 12, 2023 18:36
-
-
Save Sohamkadam333/01d2780ea6cc9d65d5b299d8527d548c to your computer and use it in GitHub Desktop.
Retrieves the current local date and time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GetLocalTime function is part of the Windows API and is used to retrieve the current local system time. | |
#include <iostream> | |
#include <windows.h> | |
using namespace std; | |
int main() | |
{ | |
SYSTEMTIME localTime; | |
GetLocalTime(&localTime); | |
cout<<"Current Local Time = "<<localTime.wHour<<":"<<localTime.wMinute<<":"<<localTime.wSecond<<endl; | |
cout<<"Current Local Date = "<<localTime.wDay<<"/"<<localTime.wMonth<<"/"<<localTime.wYear<<endl; | |
system("PAUSE"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment