C++boost日期类型返回day,month注意地方

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


void main()
{

 date myCurDatetime = from_undelimited_string("20130602122520");
 int nMonth = myCurDatetime.month();
 int nDay = myCurDatetime.day();

 int nYear = myCurDatetime.year();
 cout << nYear << endl;   //输出2013
 cout << nMonth << endl; //注意输出的是6,而不是06
 cout << nDay << endl;   //注意输出的是2,而不是02

 int wait;
 cin >> wait;
}

posted @ 2013-06-22 09:30  Predator  阅读(218)  评论(0编辑  收藏  举报