1. 程式人生 > >windows下Unix時間戳轉北京時間

windows下Unix時間戳轉北京時間

time_t nowtime = timeStamp;
struct tm stTime;
localtime_s(&stTime, &nowtime);
int year, month, day, hour, min, sec;
year = 1900 + stTime.tm_year;
month = 1 + stTime.tm_mon;
day = stTime.tm_mday;
hour = stTime.tm_hour;
min = stTime.tm_min;
sec = stTime.tm_sec;