C++标准日期时间类型转换为数字格式

#include<iostream>
#include<boost/date_time.hpp>
using namespace std;
using namespace boost::gregorian;
using namespace boost;


//2013/07/01 09:24:30
void main()
{

//date myDate ;
//myDate = from_undelimited_string("20130715131225");
//cout << to_iso_string(myDate) << endl;

string strDateTime = "2013/07/01 09:24:30";
string strDes;
strDes = strDateTime.substr(0, 4);
strDes += strDateTime.substr(5, 2);
strDes += strDateTime.substr(8, 2);
strDes += strDateTime.substr(11, 2);
strDes += strDateTime.substr(14, 2);
strDes += strDateTime.substr(17, 2);
cout << strDes << endl;

 

int wait;
cin >> wait;

}

posted @ 2013-07-20 13:25  Predator  阅读(1983)  评论(0编辑  收藏  举报