Boost logo

Boost Users :

From: Christian Henning (chhenning_at_[hidden])
Date: 2006-02-03 16:43:31


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

The expected result would something like this:

Fri Feb 3, 16:38 EDT

I'm using MSVC 7.1 and Boost 1.33.1.

Thanks in advance,
Christian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net