Skip to content

Instantly share code, notes, and snippets.

@Sohamkadam333
Created December 12, 2023 18:36
Show Gist options
  • Save Sohamkadam333/01d2780ea6cc9d65d5b299d8527d548c to your computer and use it in GitHub Desktop.
Save Sohamkadam333/01d2780ea6cc9d65d5b299d8527d548c to your computer and use it in GitHub Desktop.
Retrieves the current local date and time
// 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