//Processing date
struct tm time;
std::string date;
char dateBuff[128] = {0};
time.tm_year = atoi(md_date.getString().substr(0,4).c_str()) - 1900;
time.tm_mon = atoi(md_date.getString().substr(4,2).c_str()) - 1;
time.tm_mday = atoi(md_date.getString().substr(6,2).c_str()) ;
time.tm_hour = atoi(md_time.getString().substr(0,2).c_str()) ;
time.tm_min = atoi(md_time.getString().substr(3,2).c_str());
time.tm_sec = atoi(md_time.getString().substr(6,2).c_str());
std::string mmin = md_time.getString().substr(9,3);
time_t secs = mktime(&time);
secs += 8*60*60;
struct tm *md_localtime = localtime(&secs);
sprintf(dateBuff, "%02d%02d%02d%02d%02d", md_localtime->tm_mon+1, md_localtime->tm_mday, md_localtime->tm_hour, md_localtime->tm_min, md_localtime->tm_sec);
dateStream << md_localtime->tm_year+1900 << dateBuff << mmin ;
dateStream >> date;字符串转日期,布布扣,bubuko.com
字符串转日期
原文:http://blog.csdn.net/ctxbloger/article/details/25816631