C++boost获取当前日期时间中的日期和时间

 


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

time_duration myTime;
myTime = duration_from_string("09:58");
time_duration myOtherTime;
myOtherTime = duration_from_string("09:10");

cout << myTime.minutes() - myOtherTime.minutes() << endl;

 

 

ptime myPTime3 = second_clock::local_time(); //获取当前时间比如:20130716T164620
date myDate = day_clock::local_day(); //获取当前日期比如:20130716
cout << to_iso_string(myDate) << endl;;

 

 

 

 

 

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