#include
intmain()
{
chars[7][4]={"日","一","二","三","四","五","六"};
time_tnowtime;
structtm*timeinfo;
time(&nowtime);
timeinfo=localtime(&nowtime);
intday;
day=timeinfo->tm_wday;
printf("今天是星期");
printf("%s",s[day]);
return0;
}
structtm--時間結構,time.h定義如下:
inttm_sec;
inttm_min;
inttm_hour;
inttm_mday;
inttm_mon;
inttm_year;
inttm_wday;
inttm_yday;
inttm_isdst;
tm_year從1900年計算,所以要加1900,
月tm_mon,從0計算,所以要加1
time(&nowtime);獲取時間
localtime(&nowtime);轉為當地時間
回答的好多給點分啊!!!!!
#include
#include
intmain()
{
chars[7][4]={"日","一","二","三","四","五","六"};
time_tnowtime;
structtm*timeinfo;
time(&nowtime);
timeinfo=localtime(&nowtime);
intday;
day=timeinfo->tm_wday;
printf("今天是星期");
printf("%s",s[day]);
return0;
}
structtm--時間結構,time.h定義如下:
inttm_sec;
inttm_min;
inttm_hour;
inttm_mday;
inttm_mon;
inttm_year;
inttm_wday;
inttm_yday;
inttm_isdst;
tm_year從1900年計算,所以要加1900,
月tm_mon,從0計算,所以要加1
time(&nowtime);獲取時間
localtime(&nowtime);轉為當地時間
回答的好多給點分啊!!!!!