Output a time value with ctime
#include <iostream> #include <ctime> using namespace std; int main () { time_t rawtime; time ( &rawtime ); cout << "Current date and time is: "<< ctime (&rawtime); return 0; }