Rajeshwar
Rajeshwar

Reputation: 11651

converting 8/17/2003 to boost::gregorian::date

I am attempting to convert 8/17/2003 to boot::gregorian::date using the following code

std::string test = "08/17/2013";
date d(from_simple_string(test)); 

However I get an unhandled exception any suggestion on how to accomplish this ?

Upvotes: 0

Views: 140

Answers (1)

dunc123
dunc123

Reputation: 2713

From the boost examples:

// The following date is in ISO 8601 extended format (CCYY-MM-DD)
std::string s("2001-10-9"); //2001-October-09
date d(from_simple_string(s));
std::cout << to_simple_string(d) << std::endl;

You have the format incorrect.

Upvotes: 3

Related Questions