#include <boost/date_time/local_time/local_time.hpp>
#include <boost/lexical_cast.hpp>
#include <string>
std::string x = boost::lexical_cast<std::string>
(second_clock::local_time().date().year());
Run Code Online (Sandbox Code Playgroud)
应该做.