#include <stdio.h>
#include <time.h>
int main(int argc, char **argv)
{
time_t t = time(NULL);
struct tm dt = *localtime(&t);
printf("date time now: %d-%d-%d %d:%d:%d\n", dt.tm_year + 1900,
dt.tm_mon + 1,
dt.tm_mday,
dt.tm_hour,
dt.tm_min,
dt.tm_sec);
return(0);
}
/*
run:
date time now: 2015-6-16 9:54:49
*/