boost posix_time 获取当前时间

来源:互联网 发布:经传软件跟风统计 编辑:程序博客网 时间:2024/05/29 19:43
#include <boost/date_time/posix_time/posix_time.hpp>//时间库#define BOOST_DATE_TIME_SOURCEstring strTime = boost::posix_time::to_iso_string(boost::posix_time::second_clock::local_time());int pos = strTime.find('T');strTime.replace(pos,1,std::string("-"));strTime.replace(pos + 3,0,std::string(":"));strTime.replace(pos + 6,0,std::string(":"));cout<<strTime<<endl;

0 0
原创粉丝点击