Test Code/C++

c++ time.h

yaks101 2013. 12. 24. 14:50

#include <iostream>

#include <time.h>


using namespace std;


int main()

{

time_t now;

tm  *ltm;

now = time(0);

ltm = localtime(&now);

char buf[20];

strftime(buf, 20, "%Y-%m-%d %H:%M:%S", ltm);

cout << buf << endl;

return 0;

}