Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2003-12-24 20:20:31


On Wed, 24 Dec 2003 01:22:03 -0800 (PST), Lars Schouw wrote
> I found a solution:
>
>
> long no_days(boost::gregorian::date d1, boost::gregorian::date d2)
> {
> using namespace boost::gregorian;
> using namespace boost::posix_time;
>
> date_period dp(d1, d2);
> return dp.length().days();
> }

A little simplier would be:

 date_duration dd = d1 - d2;
 return dd.days();

There is an example of this in libs/date_time/examples/gregorian in case you
haven't found these yet...

Jeff


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net