Narek
Narek

Reputation: 39871

boost::gregorian::date does not have `set-type` functions?

For example I have a date object:

boost::gregorian::date date1(2013,1,31);

Now I want to change the day to 1. How to set day to 1?

Upvotes: 2

Views: 554

Answers (1)

Mike Seymour
Mike Seymour

Reputation: 254471

Date types are immutable, apart from assignment, so you need to make a new date:

date1 = boost::gregorian::date(date1.year(), date1.month(), 1);

Upvotes: 6

Related Questions