org.encog.util.time

## Class TimeSpan

- java.lang.Object
- - org.encog.util.time.TimeSpan

-     public class TimeSpan
      extends Object

  A timespan between two Dates.
  Author:
    jheaton

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DAYS_WEEK` Days in a week.
    `static int` | `HOURS_DAY` Hours in a day.
    `static int` | `MINUTES_HOUR` Minutes in an hour.
    `static int` | `MONTHS_YEAR` Months in a year.
    `static int` | `SECONDS_MINUTE` Seconds in a minute.
    `static int` | `YEARS_CENTURY` Years in a century.
    `static int` | `YEARS_MIL` Years in a mil.
    `static int` | `YEARS_SCORE` Years in a score.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimeSpan(Date from, Date to)` Construct a time span.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Date` | `getFrom()`
    `long` | `getSpan(TimeUnit unit)` Get the time span specified by the unit.
    `Date` | `getTo()`

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

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

- - ### Field Detail

    - #### YEARS_CENTURY

          public static final int YEARS_CENTURY

      Years in a century.
      See Also:
        Constant Field Values

    - #### HOURS_DAY

          public static final int HOURS_DAY

      Hours in a day.
      See Also:
        Constant Field Values

    - #### MINUTES_HOUR

          public static final int MINUTES_HOUR

      Minutes in an hour.
      See Also:
        Constant Field Values

    - #### SECONDS_MINUTE

          public static final int SECONDS_MINUTE

      Seconds in a minute.
      See Also:
        Constant Field Values

    - #### MONTHS_YEAR

          public static final int MONTHS_YEAR

      Months in a year.
      See Also:
        Constant Field Values

    - #### DAYS_WEEK

          public static final int DAYS_WEEK

      Days in a week.
      See Also:
        Constant Field Values

    - #### YEARS_MIL

          public static final int YEARS_MIL

      Years in a mil.
      See Also:
        Constant Field Values

    - #### YEARS_SCORE

          public static final int YEARS_SCORE

      Years in a score.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TimeSpan

          public TimeSpan(Date from,
                  Date to)

      Construct a time span.
      Parameters:
        `from` - The from date/time.
        `to` - The two date/time.

  - ### Method Detail

    - #### getFrom

          public Date getFrom()

      Returns:
        the from

    - #### getSpan

          public long getSpan(TimeUnit unit)

      Get the time span specified by the unit.
      Parameters:
        `unit` - The unit desired.
      Returns:
        The timespan in the specified unit.

    - #### getTo

          public Date getTo()

      Returns:
        the to date/time.

Copyright © 2014. All Rights Reserved.