View Code
time_t now;
time(&now);
struct tm* newtime = localtime(&now);
printf( "%4d/%02d/%02d %02d:%02d:%02d\n",
1900 + newtime->tm_year, newtime->tm_mon,newtime->tm_mday,newtime->tm_hour,newtime->tm_min, newtime->tm_sec);