date/time input facets - what am I doing wrong?

I'm trying to get input facets working for dates and times using time_input_facet. (Boost 1.33.1 on RHEL5; upgrading is not an option at the moment) std::stringstream ss; ss.str("Feb 28 16:22:11 2009"); time_input_facet* tf = new time_input_facet("%b %e %H:%M:%S %Y"); ss.imbue(std::locale(std::locale::classic(), tf)); ss.exceptions(std::ios_base::failbit); ptime z; ss >> z; std::cout<< z << std::endl; This throws an exception - Parse failed. No match found for '' I figure I'm missing something simple. (when I try a different format: "%b %e %Y %H:%M:%S" for "Feb 28 2009 11:15:11" I get a "Year is out of valid range: 1400..10000" exception??) Thanks for any insight. joe

On Fri, 12 Jun 2009 17:36:39 +0200, Joe Nardone
I'm trying to get input facets working for dates and times using time_input_facet.
(Boost 1.33.1 on RHEL5; upgrading is not an option at the moment)
std::stringstream ss; ss.str("Feb 28 16:22:11 2009"); time_input_facet* tf = new time_input_facet("%b %e %H:%M:%S %Y"); ss.imbue(std::locale(std::locale::classic(), tf)); ss.exceptions(std::ios_base::failbit);
ptime z; ss >> z;
std::cout<< z << std::endl;
This throws an exception - Parse failed. No match found for ''
Replace %e with %d and try "%b %d %H:%M:%S %Y". Boris
participants (3)
-
Boris Schaeling
-
Joe N.
-
Joe Nardone