Try this:
#include <iostream>
#include "boost/date_time/gregorian/gregorian.hpp"
namespace bdt = boost::gregorian;
int main(void)
{
bdt::date today(bdt::date(2010, bdt::Jun, 13));
bdt::date electionDay(bdt::date(2010, bdt::Nov, 2));
bdt::date_period range(today, electionDay);
std::cout << "Days between " << today
<< " and " << electionDay
<< " is " << range.length() << std::endl;
return 0;
}
Found it here[^]