Maybe this helps:
Code:#include <cstdio> #include <iostream> #include <ctime> using namespace std; int main () { time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); int day = timeinfo->tm_mday; int month = timeinfo->tm_mon + 1; int year = timeinfo-> tm_year + 1900; cout << "day = " << day << endl; cout << "month = " << month << endl; cout << "year = " << year << endl; system("PAUSE"); return 0; }