#include<time.h>
#include<stdio.h>
int main()
{
time_t now;
time(&now);
//ctime 转换为字符串
printf("ctime:%s",ctime(&now));
struct tm *t;
t=localtime(&now);
char n[100];
//格式化输出字符串
strftime(n,100,"%F %T",t);
printf("strftime:%s\n",n);
return 0;
}