Hi All,
I very rarely post threads, but I'm just getting back into C++ from pure C (amongst other miscellaneous languages) and I've been trying out boost on my next task. Can anyone give me an idea how I can convert a date time string of Sat, 15 Sep 2007 01:25:06 EDT into a boost date_time class? I've tried a number of things, but come up empty. Here's my latest:
Code:
static std::string get_proper_datetime(const std::string &dt)
{
boost::gregorian::date_input_facet *date_f =
new boost::gregorian::date_input_facet("%a, %d %b %Y %H:%M:%S %z");
std::stringstream ss;
ss.str(dt);
ss.imbue(std::locale(ss.getloc(), date_f));
boost::local_time::local_date_time ldt(boost::local_time::not_a_date_time);
ss >> ldt;
std::cout << ldt << std::endl;
return "";
}
which just returns "not-a-date-time".
Thanks!