Package groovy.time

# Class DatumDependentDuration

java.lang.Object
groovy.time.BaseDuration
groovy.time.DatumDependentDuration

All Implemented Interfaces:
  `Comparable<BaseDuration>`

Direct Known Subclasses:
  `TimeDatumDependentDuration`

public class DatumDependentDuration extends BaseDuration
DatumDependentDuration represents durations whose length in milliseconds cannot be determined without knowing the datum point.

I don't know how many days in a year unless I know if it's a leap year or not.

I don't know how many days in a month unless I know the name of the month (and if it's a leap year if the month is February)

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class groovy.time.BaseDuration

  `BaseDuration.From`

- ## Field Summary

  ### Fields inherited from class groovy.time.BaseDuration

  `days, hours, millis, minutes, months, seconds, years`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DatumDependentDuration(int years, int months, int days, int hours, int minutes, int seconds, int millis)`
  Creates a datum-dependent duration.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Date`
  `getAgo()`
  Returns the date represented by this duration ago.
  `BaseDuration.From`
  `getFrom()`
  Returns a helper for computing dates relative to now.
  `int`
  `getMonths()`
  Returns the month component.
  `int`
  `getYears()`
  Returns the year component.
  `DatumDependentDuration`
  `minus(DatumDependentDuration rhs)`
  Subtracts another datum-dependent duration.
  `DatumDependentDuration`
  `minus(Duration rhs)`
  Subtracts a fixed duration.
  `DatumDependentDuration`
  `plus(DatumDependentDuration rhs)`
  Adds another datum-dependent duration.
  `DatumDependentDuration`
  `plus(Duration rhs)`
  Adds a fixed duration.
  `DatumDependentDuration`
  `plus(TimeDatumDependentDuration rhs)`
  Adds a mixed time and datum-dependent duration.
  `DatumDependentDuration`
  `plus(TimeDuration rhs)`
  Adds a time duration.
  `long`
  `toMilliseconds()`
  Converts this duration to milliseconds.

  ### Methods inherited from class groovy.time.BaseDuration

  `compareTo, getDays, getHours, getMillis, getMinutes, getSeconds, plus, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### DatumDependentDuration

    public DatumDependentDuration(int years, int months, int days, int hours, int minutes, int seconds, int millis)
    Creates a datum-dependent duration.
    Parameters:
      `years` - the year component
      `months` - the month component
      `days` - the day component
      `hours` - the hour component
      `minutes` - the minute component
      `seconds` - the second component
      `millis` - the millisecond component

- ## Method Details

  - ### getMonths

    public int getMonths()
    Returns the month component.
    Overrides:
      `getMonths` in class `BaseDuration`
    Returns:
      the month component

  - ### getYears

    public int getYears()
    Returns the year component.
    Overrides:
      `getYears` in class `BaseDuration`
    Returns:
      the year component

  - ### plus

    public DatumDependentDuration plus(DatumDependentDuration rhs)
    Adds another datum-dependent duration.
    Parameters:
      `rhs` - the duration to add
    Returns:
      the combined duration

  - ### plus

    public DatumDependentDuration plus(TimeDatumDependentDuration rhs)
    Adds a mixed time and datum-dependent duration.
    Parameters:
      `rhs` - the duration to add
    Returns:
      the combined duration

  - ### plus

    public DatumDependentDuration plus(Duration rhs)
    Adds a fixed duration.
    Parameters:
      `rhs` - the duration to add
    Returns:
      the combined duration

  - ### plus

    public DatumDependentDuration plus(TimeDuration rhs)
    Adds a time duration.
    Parameters:
      `rhs` - the duration to add
    Returns:
      the combined duration

  - ### minus

    public DatumDependentDuration minus(DatumDependentDuration rhs)
    Subtracts another datum-dependent duration.
    Parameters:
      `rhs` - the duration to subtract
    Returns:
      the resulting duration

  - ### minus

    public DatumDependentDuration minus(Duration rhs)
    Subtracts a fixed duration.
    Parameters:
      `rhs` - the duration to subtract
    Returns:
      the resulting duration

  - ### toMilliseconds

    public long toMilliseconds()
    Description copied from class: `BaseDuration`
    Converts this duration to milliseconds.
    Specified by:
      `toMilliseconds` in class `BaseDuration`
    Returns:
      the duration in milliseconds
    See Also:
      - `Change the duration into milliseconds, relative to 'now.' Therefore things like timezone and time of year will affect how this conversion occurs.`

  - ### getAgo

    public Date getAgo()
    Returns the date represented by this duration ago.
    Specified by:
      `getAgo` in class `BaseDuration`
    Returns:
      the computed date

  - ### getFrom

    public BaseDuration.From getFrom()
    Returns a helper for computing dates relative to now.
    Specified by:
      `getFrom` in class `BaseDuration`
    Returns:
      the relative-date helper