我搞不懂,发帖的时候我还仔细看了一边,帖子没错啊,发出来就变乱码了,难道是我小糊涂了?#include <stdio.h>
#include <time.h>
int main(void)
{
time_t nowtime;
printf(" 计算机时间:%u\n",time(&nowtime));
printf(" 本地时间:%d年%d月%d日,%d:%d:%d\n", localtime(&nowtime)->tm_year + 1900, localtime(&nowtime)->tm_mon + 1, localtime(&nowtime)->tm_mday, localtime(&nowtime)->tm_hour, localtime(&nowtime)->tm_min, localtime(&nowtime)->tm_sec);
printf(" 世界时间:%d年%d月%d日,%d:%d:%d\n", gmtime(&nowtime)->tm_year + 1900, gmtime(&nowtime)->tm_mon + 1, gmtime(&nowtime)->tm_mday, gmtime(&nowtime)->tm_hour, gmtime(&nowtime)->tm_min, gmtime(&nowtime)->tm_sec);
printf("asctime函数表示:%s", asctime(localtime(&nowtime)));
printf(" ctime函数表示:%s", ctime(&nowtime));
return 0;
}
现在补发代码吧 |