Reputation: 3125
I have a set of dates represented as strings and whilst it is easy to convert these to date types, I must perform calculations which will require the previous days date. So for example if I have the date 13-09-2013 I will need to derive the date 12-09-2013. Is there a clean way of achieving this? Ideally using boost.
thanks un advance
Upvotes: 2
Views: 1594
Reputation: 103751
using namespace boost::gregorian;
date d(2013,Sep,13);
d -= days(1);
Upvotes: 9
Reputation: 409472
Just get the current date, subtract one day, and you have yesterday.
Upvotes: 3