// Simple program to get the date and time on Windows // It compiles and works fine but displays the wrong hour!
// Using Visual C++ 2008 Express on XP SP2
#include <Windows.h>
#include <iostream>
using namespace std;
void main()
{
SYSTEMTIME st;
GetSystemTime(&st);
cout << "Year : " << st.wYear << "\n";
cout << "Month : " << st.wMonth << "\n";
cout << "Day : " << st.wDay << "\n";
// The following line displays the wrong hour, off by 4 hours.
// What gives?
cout << "Hour : " << st.wHour << "\n";
cout << "Minute : " << st.wMinute << "\n";
cout << "Second : " << st.wSecond << "\n";
}
// TIA guys!
// -- Bert