首页 > 代码库 > c++自定义时间输出

c++自定义时间输出

#include <time.h>

time_t timep;

struct tm *p;

time(&timep);

p=localtime(&timep);

int logminute = p->tm_min/10*10;

int loghour=p->tm_hour;

if(logminute == 60)

{

logminute=0;

loghour=loghour+1;

}

string showtime=FormatString("%04d%02d%02d%02d%02d",(1900+p->tm_year),(1+p->tm_mon),p->tm_day,loghour,logminute);

c++自定义时间输出