#include <time.h>
#include <iostream>
#include <cstring>
#include <sstream>
using namespace std;
int main()
{
tm tm_;
time_t t_;
char buf[128] = {0};
ostringstream timer;
timer<<"20150216"<<" 23:59:59";
strptime((timer.str()).c_str(), "%Y%m%d %H:%M:%S", &tm_);
tm_ = *localtime(&t_);
strftime(buf, 64, "%Y%m%d", &tm_);
return 0;
}
#include <iostream>
#include <cstring>
#include <sstream>
using namespace std;
int main()
{
tm tm_;
time_t t_;
char buf[128] = {0};
ostringstream timer;
timer<<"20150216"<<" 23:59:59";
strptime((timer.str()).c_str(), "%Y%m%d %H:%M:%S", &tm_);
t_ = mktime(&tm_);
//变成秒数进行相加减
t_ += 86400;tm_ = *localtime(&t_);
strftime(buf, 64, "%Y%m%d", &tm_);
return 0;
}