time_t local_time;
struct tm *t;
time(&local_time);
t=gmtime(&local_time);
printf("当前时间为:%d/%d/%d/%d/%d/%d\n",t->tm_year+1900,t->tm_mon+1,t->tm_mday,t->tm_hour+8,t->tm_min,t->tm_sec);
Ps:因为直接获取的那些时间不是北京时间,需要另外处理一下才可以~
time_t local_time;
struct tm *t;
time(&local_time);
t=gmtime(&local_time);
printf("当前时间为:%d/%d/%d/%d/%d/%d\n",t->tm_year+1900,t->tm_mon+1,t->tm_mday,t->tm_hour+8,t->tm_min,t->tm_sec);
Ps:因为直接获取的那些时间不是北京时间,需要另外处理一下才可以~