二十四节气数据表c语言
# include & lttime.h & gt
int main()
{
time _ t rawtime
struct tm * timeinfo
时间(& ampraw time);
timeinfo = local time(& amp;raw time);
int年、月、日、小时、分钟、秒;
year = 1900+timeinfo->;tm _ year
month = 1+timeinfo-& gt;tm _ mon
day = time info-& gt;tm _ mday
hour = time info-& gt;tm _ hour
min = time info-& gt;tm _ min
sec = time info-& gt;tm _ sec
Printf("当前时间:% 4d-% 02d-% 02d % 02d:% 02d:% 02d \ n \ n ",年、月、日、小时、分钟、秒);
Printf("需要的格式:% 4d% 02d% 02d% 02d \ n \ n ",年、月、日、时、分、秒);
char hyy[2],lyy[2],mm[2],dd[2],hh[2],MM[2],ss[2];
sprintf(hyy," %02X ",年/100);
sprintf(lyy," %02X ",年份% 100);
sprintf(MM,“%02X”,月);
sprintf(dd," %02X ",day);
sprintf(hh,“%02X”,小时);
sprintf(mm," %02X ",min);
sprintf(ss," %02X ",秒);
printf(" Convert to 16:% 02s % 02s % 02s % 02s \ n ",HYY,LYY,MM,DD,HH,MM,SS);
//exit(0);
返回0;
}?
描述:我现在用VC6.0写的,运行结果截图如下:?