
What format do you want for your date ? In your first mail, you mention "MM-DD-YYYY" for the format but in your sample you use a "DD-MM-YYYY" format ! If you want the "DD-MM-YYYY" format, you can simply use the function boost::gregorian::from_uk_string(std::string s). Alexandre -----Message d'origine----- De : boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] De la part de Christian Henning Envoyé : mercredi 22 mars 2006 16:30 À : boost-users@lists.boost.org Objet : Re: [Boost-users] [date_time] How to create a datefromstringwithspecific format? Alexandre, the following code will give an exception stating "Error: Year is out of valid range: 1400..10000". I don't think the myDate object is correctly initialized. Can you check this on your machine, please. Can you call myDate.year_month_day()? date_input_facet* pMyFacet = new date_input_facet( "%m-%d-%Y" ); std::locale loc( std::locale::classic(), pMyFacet ); std::istringstream oo; oo.str( "22-03-2006" ); date myDate; try { oo >> myDate; date::ymd_type ymd = myDate.year_month_day(); } catch( std::out_of_range oEx ) { std::cout << "Error: " << oEx.what() << std::endl; } Thanks ahead, Christian _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users