Boost C++ Libraries: Ticket #622: time_from_string silently misreads date https://svn.boost.org/trac10/ticket/622 <pre class="wiki">The following code snippet: boost::posix_time::ptime t3 = boost::posix_time::time_from_string ("2006-03-02"); cout &lt;&lt; " t3 = " &lt;&lt; boost::posix_time::to_simple_string(t3) &lt;&lt; endl; Gives: t3 = 2006-May-24 14:03:02 Admittedly, the date-time string is misformatted, as it doesn't have the HH-MM-SS fields, but silently giving the wrong dete is likely to be a very serious problem to users. For the record, let me say that date_time and boost is general are really very fine work which I greatly appreciate. -Mike Albert MAlbert@princeton.com </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/622 Trac 1.4.3 az_sw_dude Sat, 06 May 2006 02:36:13 GMT <link>https://svn.boost.org/trac10/ticket/622#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/622#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=579686 Hi Mike -- Have you considered using the new streaming i/o system instead of the from_string calls? The new i/o framework has much better error handling than the time_from_string calls. Basically you can recode your example this way: std::stringstream ss("2006-03-02")) ptime t; ss &gt;&gt; t; //throws bad month At the moment I'm not terribly inclined to try and fix the older parsers as I plan to eventually replace them with stringstream code under the hood. Jeff </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Gennaro Prota</dc:creator> <pubDate>Thu, 03 Aug 2006 07:11:54 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/622#comment:2 https://svn.boost.org/trac10/ticket/622#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> Ticket