代码:
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main()
{
time_t Time;
struct tm *t;
/* time_t time(time_t *t) */
Time = time(NULL);
/* struct tm *localtime(const time_t *t) */
t = localtime(&Time);
/* char *asctime(struct tm *p) */
/* Format : week month day hour:minute:second year */
printf("Time : %s",asctime(t));
return 0;
}
运行结果: