"Christian Henning"
Hi there, I'm trying to format a time string based on a local_time_facet. For some reason it isn't working as expected. Here is the code (I basically copied from the Date Time IO Tutorial):
ptime t( microsec_clock::local_time() );
std::stringstream ss;
local_time_facet* output_facet = new local_time_facet(); ss.imbue( std::locale( std::locale::classic(), output_facet));
output_facet->format("%a %b %d, %H:%M %z"); ss.str(""); ss << t; std::cout << ss.str() << std::endl;
The output isn't formated in the way it's specified. Cout will basically spit out the same result as to_simple_string().
2006-Feb-03 16:38:57.046875
That would be because you are attempting to use a local_time_facet to output a ptime. Use either a time_facet to output a ptime object, or a local_time_facet to output a local_date_time object. Bart