#include <stdio.h>
#include <time.h>int main()
{ struct tm *local; time_t t; t = time(NULL); local = localtime(&t);printf("local year:%d\n", local->tm_year+1900);
printf("local month:%d\n", local->tm_mon+1); printf("local day:%d\n", local->tm_mday); printf("local hour:%d\n", local->tm_hour); printf("local minute:%d\n", local->tm_min); printf("local sec:%d\n", local->tm_sec); printf("asctime:%s", asctime(local)); printf("ctime:%s", ctime(&t)); return 0; }