#include <stdio.h>
#include <time.h>
int main()
{
time_t nowtime;
struct tm* p;;
time(&nowtime);
p = localtime(&nowtime);
char time[30] = "";
sprintf(time, "%04d-%02d-%02d %02d:%02d:%02d", p->tm_year+1900, p->tm_mon+1, p->tm_mday,p->tm_hour,p->tm_min,p->tm_sec);
printf("%s\n", time);
/*printf("%02d:%02d:%02d\n",p->tm_hour,p->tm_min,p->tm_sec);*/
return 0;
}