如果我这样做,我对如何使用 tm 结构对象感到有些困惑;
printf("The current date is %d-%d-%d\n", now.tm_mon, now.tm_mday, now.tm_year);
我的输出是;
The current date is 11-31-112
但是当我这样做时;
printf("The current date is %d-%d-%d\n", now.tm_mon + 1, now.tm_mday, now.tm_year
+ 1900);
我的输出是;
The current date is 12-31-2012
我有点糊涂了怎么把+1和+1900的加法正确格式化输出时间?预先感谢您的任何帮助!