Hello,

 

I tried the below code:

#include <boost/date_time.hpp>
#include
<boost/date_time/posix_time/ptime.hpp>

#include
<iostream>
using namespace boost::posix_time;

int main()
{
std::
string _format1 = "%Y-%m-%d %H:%M:%S";
std::
string _format2 = "%Y-%m-%e %H:%M:%S";

std::
string teststring = "2010-09-10 10:01:01";
ptime time1, time2;

time_input_facet facet1(_format1,
1);
time_input_facet facet2(_format2,
1);

std::stringstream ss1(teststring);
std::stringstream ss2(teststring);

ss1.imbue(std::locale(ss1.getloc(),
&facet1));
ss1
>> time1;

ss2.imbue(std::locale(ss2.getloc(),
&facet2));
ss2
>> time2;

std::cout
<< "Time1: " << time1 << std::endl;
std::cout
<< "Time2: " << time2 << std::endl;
return 0;
}

The output is:

Time1: 2010-Sep-10 10:01:01
Time2: not-a-date-time


 

Howto fix the issue for the format using "%e"?

 

Thanks!