| Home | Libraries | People | FAQ | More

## Class date_duration

boost::gregorian::date_duration — Durations in days for gregorian system.

## Synopsis

    // In header: <boost/date_time/gregorian/greg_duration.hpp>

    class date_duration :
      public boost::date_time::date_duration< date_duration_rep >
    {
    public:
      // types
      typedef base_type::duration_rep duration_rep;

      // public member functions
      explicit date_duration(duration_rep = 0);
      date_duration(date_time::special_values);
      date_duration(const base_type &);
      BOOST_CXX14_CONSTEXPR bool operator==(const date_duration &) const;
      BOOST_CXX14_CONSTEXPR bool operator!=(const date_duration &) const;
      BOOST_CXX14_CONSTEXPR bool operator<(const date_duration &) const;
      BOOST_CXX14_CONSTEXPR bool operator>(const date_duration &) const;
      BOOST_CXX14_CONSTEXPR bool operator<=(const date_duration &) const;
      BOOST_CXX14_CONSTEXPR bool operator>=(const date_duration &) const;
      BOOST_CXX14_CONSTEXPR date_duration & operator-=(const date_duration &);
      BOOST_CXX14_CONSTEXPR date_duration & operator+=(const date_duration &);
      BOOST_CXX14_CONSTEXPR date_duration operator-() const;
      BOOST_CXX14_CONSTEXPR date_duration & operator/=(int);

      // public static functions
      static BOOST_CXX14_CONSTEXPR date_duration unit();
    };

## Description

### `date_duration` public member functions

1.     explicit date_duration(duration_rep day_count = 0);

   Construct from a day count.

2.     date_duration(date_time::special_values sv);

   construct from special_values

3.     date_duration(const base_type & other);

   Construct from another date_duration.

4.     BOOST_CXX14_CONSTEXPR bool operator==(const date_duration & rhs) const;

5.     BOOST_CXX14_CONSTEXPR bool operator!=(const date_duration & rhs) const;

6.     BOOST_CXX14_CONSTEXPR bool operator<(const date_duration & rhs) const;

7.     BOOST_CXX14_CONSTEXPR bool operator>(const date_duration & rhs) const;

8.     BOOST_CXX14_CONSTEXPR bool operator<=(const date_duration & rhs) const;

9.     BOOST_CXX14_CONSTEXPR bool operator>=(const date_duration & rhs) const;

10.     BOOST_CXX14_CONSTEXPR date_duration & operator-=(const date_duration & rhs);

    Subtract another duration – result is signed.

11.     BOOST_CXX14_CONSTEXPR date_duration & operator+=(const date_duration & rhs);

    Add a duration – result is signed.

12.     BOOST_CXX14_CONSTEXPR date_duration operator-() const;

    unary- Allows for dd = -date_duration(2); -> dd == -2

13.     BOOST_CXX14_CONSTEXPR date_duration & operator/=(int divisor);

    Division operations on a duration with an integer.

### `date_duration` public static functions

1.     static BOOST_CXX14_CONSTEXPR date_duration unit();

   Returns the smallest duration – used by to calculate 'end'.