|
Boost Users : |
From: Christian Henning (chhenning_at_[hidden])
Date: 2006-03-22 11:09:53
Thank you very much. I was not paying to attention. My fault.
For the records, here is a sample that works:
date_input_facet* pMyFacet = new date_input_facet( "%m-%d-%Y" );
std::istringstream oo;
oo.imbue( std::locale(oo.getloc(), pMyFacet ));
oo.str( "11-03-2006" );
date myDate;
try
{
oo >> myDate;
date::ymd_type ymd = myDate.year_month_day();
std::cout << myDate;
}
catch( std::out_of_range oEx )
{
std::cout << "Error: " << oEx.what() << std::endl;
}
Unfortunately a string like "11-3-1997" wont work since the day is
just a single digit. Is that something the date_time lib will be able
to understand in the future?
Thanks,
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