Reputation: 63310
I have the following std::string
'2010-08-10T23:59:00' and I need to convert it to a boost::gregorian::date
object.
I know I should use boost::date_time::date_input_facet
, but I just cannot seem to figure out how to do it.
Can someone please assist me as to how to do this conversion?
Upvotes: 1
Views: 696
Reputation: 5398
boost's posix_time module supports a direct conversion from that form (which unless I'm confused is the ISO time format?). Take a look at:
boost::posix_time::from_iso_string
You just need to strip the formatting marks first.
posix_time::time_from_string
may work for you as well.
You should them be able to convert the posix_time into gregorian.
Hope this helps.
Upvotes: 1