Boost C++ Libraries: Ticket #167: Gregorian dates bugs https://svn.boost.org/trac10/ticket/167 <pre class="wiki">1. I read docs about boost::gregorian::date. It has the accessor 'greg_ymd year_month_day() const', but I can't find 'greg_ymd' type anywhere. 2. So I use date::ymd_type instead. All looks like except the following: Tools.h ========================================== #ifndef TOOLS_H #define TOOLS_H #include &lt;boost/date_time/gregorian/gregorian.hpp&gt; typedef boost::gregorian::date Date; typedef boost::gregorian::date_period Period; std::string DateToString(Date d); #endif ========================================== Tools.cpp ========================================== #include &lt;sstream&gt; #include &lt;iomanip&gt; #include "Tools.h" using namespace std; using namespace boost::gregorian; string DateToString(Date d) { ostringstream os; int m=d.month(); os&lt;&lt;setw(2)&lt;&lt;setfill('0')&lt;&lt;d.day()&lt;&lt;'/'&lt;&lt; setw(2)&lt;&lt;m&lt;&lt;'/'&lt;&lt;setw(4)&lt;&lt;d.year(); return os.str(); } ========================================== That's working perfectly! Now I slightly change code of Tools.cpp (remove 'm' variable): ========================================== #include &lt;sstream&gt; #include &lt;iomanip&gt; #include "Tools.h" using namespace std; using namespace boost::gregorian; string DateToString(Date d) { ostringstream os; os&lt;&lt;setw(2)&lt;&lt;setfill('0')&lt;&lt;d.day()&lt;&lt;'/'&lt;&lt; setw(2)&lt;&lt;d.month()&lt;&lt;'/'&lt;&lt;setw(4)&lt;&lt;d.year(); return os.str(); } ========================================== And my app crashes!!! </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/167 Trac 1.4.3 ysv_ Mon, 23 Jun 2003 13:36:41 GMT <link>https://svn.boost.org/trac10/ticket/167#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/167#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=779069 Sorry, I forgot to report my system. I'm using MinGW 3.2.3. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>az_sw_dude</dc:creator> <pubDate>Mon, 22 Nov 2004 13:38:27 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/167#comment:2 https://svn.boost.org/trac10/ticket/167#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=579686 For issue 1, the 1.32 release has full reference documentation. As for the application crash there have been issues in some OS/compiler combinations that had regression failures with streaming of the greg_month class which is the type return by d.month(). However, MinGW now appears to pass all the regression tests related to streaming with the exception of wide character support. So I think this is likely resolved in the 1.32 release. </pre> Ticket