Boost C++ Libraries: Ticket #6664: std::setw() is ignored by operator<< for ptime, time_duration, and date https://svn.boost.org/trac10/ticket/6664 <p> The following complete program demonstrates the issue. when using operator&lt;&lt; to display a ptime/time_duration/date, then the setw() manipulator is ignored. </p> <p> My development environment is boost 1.48, building a 32-bit app on Win7 (x64) under VS2008. </p> <p> I consider this a cosmetic issue as there is a very simple work-aroud - simply manually convert the ptime/date/duration object to a string before inserting it into the ostream object. </p> <pre class="wiki">#include &lt;boost/date_time/posix_time/posix_time.hpp&gt; #include &lt;boost/date_time/gregorian/gregorian.hpp&gt; #include &lt;iomanip&gt; #include &lt;iostream&gt; #include &lt;string&gt; int main() { boost::posix_time::ptime const now = boost::posix_time::second_clock::local_time(); std::cout &lt;&lt; "\ncorrectly formatted: " &lt;&lt; std::setw(40) &lt;&lt; boost::posix_time::to_simple_string(now) &lt;&lt; "\nptime: " &lt;&lt; std::setw(40) &lt;&lt; now &lt;&lt; "\ntime_duration: " &lt;&lt; std::setw(40) &lt;&lt; now.date() &lt;&lt; "\ndate: " &lt;&lt; std::setw(40) &lt;&lt; now.time_of_day() &lt;&lt; std::endl; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6664 Trac 1.4.3