Anyone know how to get a simple date format from boost of the current time to a local system?
boost::posix_time::ptime now = boost::posix_time::second_clock::universal_time();
boost::posix_time::time_facet *facet = new boost::posix_time::time_facet("%d-%m-%Y %H:%M:%S");
I’ve seen examples that say to use cout.imbue but I just want a simple string.
you can try this code:
Set format to
"%d-%m-%Y %H:%M:%S"or whatever facet you want.For the local time, use
boost::posix_time::second_clock::local_time()as the second argument (date_time).