programming-examples/c++/Basic/Current Date.cpp
2019-11-18 14:44:36 +01:00

14 lines
333 B
C++

#include <ctime>
#include <iostream>
using namespace std;
int main()
{
time_t t = time(0); // get time now
struct tm * now = localtime( & t );
cout << "Current Date is : "
cout << now->tm_mday << '-'<< (now->tm_mon + 1) << '-' << (now->tm_year + 1900) << endl;
}
Output
Current Date is : 16-6-2015