timecube.tm_year=y-1900;timecube.tm_mon=m-1;timecube.tm_mday=d;timecube.tm_hour=hh;timecube.tm_min=mm;timecube.tm_sec=ss;ptime=&timecube;curr=mktime(ptime);if(-1 == curr)printf("时间有误");printf("%ld",curr);getch();} 关键是对于struct tm结构体的赋值,加上了 ...
timecube.tm_year = year-1900;timecube.tm_mon = month;timecube.tm_mday = day;timecube.tm_hour = 11;timecube.tm_min = 15;timecube.tm_sec = 56;精确到秒就可以了