Reputation: 4607
I have two boost ptime's time_from
and time_to
i want to find each date between those two times, i initially did
const auto date_duration(time_to.date() - time_from.date());
for(int i = 0; i < date_duration.days(); ++i)
{
time_from.date() + boost::gregorian::days(i);
}
i was thinking the date calculated in the loop if stored would give me each date between the two times however it didnt work because this was giving me the number of days between the two times as opposed to each individual date between the two times, i was wondering if anyone knows the best way to get this?
Upvotes: 2
Views: 115
Reputation: 4689
Try this:
day_iterator itr(time_from.date());
while (itr <= time_to.date()) {
std::cout << (*itr) << std::endl;
++itr;
}
Upvotes: 2