#include <time.h>

 

struct tm *today;

 

time(&ltime);

today = localtime(&ltime);

printf("%04d-%02d-%02d %02d:%02d:%02d\n",
today->tm_year + 1900,   // tm_year는 1900을 더해야 서기 연도가 됨
today->tm_mon + 1, // tm_mon은 1월이 0, 2월이 1... 식으로 되어 있음 
today->tm_mday,
today->tm_hour,
today->tm_min,
today->tm_sec);

이 글은 스프링노트에서 작성되었습니다.

'IT > Language' 카테고리의 다른 글

javacore&heapdump  (0) 2008.09.19
@Override annotation  (0) 2008.09.16
java sleep (시간동안 수행)  (0) 2008.05.19
EBCDIC 변환  (0) 2008.05.19
JDK Bit 확인  (0) 2008.02.11

+ Recent posts