본문 바로가기

Test Code/C++

c++ time.h

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

}

'Test Code > C++' 카테고리의 다른 글

[C++]배열 사이즈 구하기  (0) 2013.12.27
[STL] algorithm for_each 예제  (0) 2013.12.27
c++ 문자를 숫자로 숫자를 문자로  (0) 2013.12.24
WinApi - 사용중인 프로세스 조회  (0) 2013.12.21
Mingw - Split 함수 만들기  (0) 2013.12.21