I have boost::posix_time::ptimeone that points March 31st 2010like this:
ptime p(date(2010, Mar, 31));
I would like to deduct the month (and possibly years) from that date. From the documents I see these two operators: ptime operator-(time_duration)and ptime operator-(days), but none of them can work with months / years. If I try to do:
time_duration duration = hours(24 * 30);
ptime pp = p - duration;
I get March 1st, and if I try:
ptime pp = p - days(30);
I still get March 1st, and I want to get February 28th.
How can I achieve the desired result? (I would like to get the desired result when subtracting the month from March 28, 29, 30).
source
share