如何将boost ptime转换为std字符串?我尝试了多种方法,并得到编译时错误。但根据助推的说法,这样做应该是可能的。
std::string function()
{
now = boost::posix_time::second_clock::local_time();
return std::string(now);
}发布于 2014-03-25 21:29:12
下面是一个最小的工作示例
看吧,住在Coliru
#include "boost/date_time/posix_time/time_formatters_limited.hpp"
int main()
{
using namespace boost::posix_time;
ptime now = second_clock::local_time();
std::cout << to_simple_string(now) << std::endl;
}https://stackoverflow.com/questions/22646120
复制相似问题