Package org.apache.groovy.dateutil

# Class TimeCategory

java.lang.Object
org.apache.groovy.dateutil.TimeCategory

public class TimeCategory extends Object
A dequirked, `java.util.Date`-flavored parallel to the legacy `groovy.time.TimeCategory`. Use as:

     use (org.apache.groovy.dateutil.TimeCategory) {
         println 1.minute.from.now
         println 10.hours.ago
         def someDate = new Date()
         println someDate - 3.months
     }

Differences from the legacy class: the deprecated `getTimeZone` and the `getDaylightSavingsOffset` helpers are dropped, and `.ago`/`.from.now` preserve the time-of-day (see `BaseDuration`).

See Also:
  - `BaseDuration`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TimeCategory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Duration`
  `getDay(Integer self)`
  `static Duration`
  `getDays(Integer self)`
  `static TimeDuration`
  `getHour(Integer self)`
  `static TimeDuration`
  `getHours(Integer self)`
  `static TimeDuration`
  `getMillisecond(Integer self)`
  `static TimeDuration`
  `getMilliseconds(Integer self)`
  `static TimeDuration`
  `getMinute(Integer self)`
  `static TimeDuration`
  `getMinutes(Integer self)`
  `static DatumDependentDuration`
  `getMonth(Integer self)`
  `static DatumDependentDuration`
  `getMonths(Integer self)`
  `static TimeDuration`
  `getSecond(Integer self)`
  `static TimeDuration`
  `getSeconds(Integer self)`
  `static Duration`
  `getWeek(Integer self)`
  `static Duration`
  `getWeeks(Integer self)`
  `static DatumDependentDuration`
  `getYear(Integer self)`
  `static DatumDependentDuration`
  `getYears(Integer self)`
  `static TimeDuration`
  `minus(Date lhs, Date rhs)`
  `static Date`
  `minus(Date date, BaseDuration duration)`
  `static Date`
  `plus(Date date, BaseDuration duration)`

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

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

- ## Constructor Details

  - ### TimeCategory

    public TimeCategory()

- ## Method Details

  - ### plus

    public static Date plus(Date date, BaseDuration duration)

  - ### minus

    public static Date minus(Date date, BaseDuration duration)

  - ### minus

    public static TimeDuration minus(Date lhs, Date rhs)

  - ### getMonths

    public static DatumDependentDuration getMonths(Integer self)

  - ### getMonth

    public static DatumDependentDuration getMonth(Integer self)

  - ### getYears

    public static DatumDependentDuration getYears(Integer self)

  - ### getYear

    public static DatumDependentDuration getYear(Integer self)

  - ### getWeeks

    public static Duration getWeeks(Integer self)

  - ### getWeek

    public static Duration getWeek(Integer self)

  - ### getDays

    public static Duration getDays(Integer self)

  - ### getDay

    public static Duration getDay(Integer self)

  - ### getHours

    public static TimeDuration getHours(Integer self)

  - ### getHour

    public static TimeDuration getHour(Integer self)

  - ### getMinutes

    public static TimeDuration getMinutes(Integer self)

  - ### getMinute

    public static TimeDuration getMinute(Integer self)

  - ### getSeconds

    public static TimeDuration getSeconds(Integer self)

  - ### getSecond

    public static TimeDuration getSecond(Integer self)

  - ### getMilliseconds

    public static TimeDuration getMilliseconds(Integer self)

  - ### getMillisecond

    public static TimeDuration getMillisecond(Integer self)