#include
#include
void main(void)
{
int year, mon, day; //要用来存日期的//
int hour, min, sec; //要用来存时间的//
time_t T; //要用来存系统时间的//
struct tm *TimeP; //要用来指到localtime()传回的位址的//
T = time(NULL); //将系统时间存到T //
TimeP = localtime( &T ); // TimeP指到localtime算好的资料所在位址//
//接下来就来看TimeP所指到的地方放了什么^^ //
year = ( TimeP->tm_year ) + 1900;
mon = ( TimeP->tm_mon ) + 1;
day = ( TimeP->tm_mday );
hour = ( TimeP->tm_hour );
min = ( TimeP->tm_min );
sec = ( TimeP->tm_sec );
cout <<>
/**********************************/
time_t T;
tm TimeP = { 0 };
T = time(NULL);
localtime_s( &TimeP , &T );