|
Boost Users : |
Subject: [Boost-users] date/time input facets - what am I doing wrong?
From: Joe Nardone (jnardone_at_[hidden])
Date: 2009-06-12 11:36:39
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
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