Output a time value with ctime : Time « Development « C++






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;
}
  
    
  








Related examples in the same category

1.Use system timeUse system time
2.Overload date() for time_t.Overload date() for time_t.
3.Using ctime() to get the current time