Groovy Documentation

## groovy.time
[Java] Class TimeCategory

    java.lang.Object
      groovy.time.TimeCategory

    public class TimeCategory
    extends java.lang.Object

Apply a number of methods to allow convenient Date/Time manipulation,such as:

     use ( TimeCategory ) {
         // application on numbers:
         println 1.minute.from.now
         println 10.hours.ago

         // application on dates
         def someDate = new Date()
         println someDate - 3.months
     }

See Also:
  BaseDuration

Method Summary
`static Duration` | `getDay(java.lang.Integer self)`
`static Duration` | `getDaylightSavingsOffset(java.util.Date self)` Get the DST offset (if any) for the default locale and the given date.
`static Duration` | `getDaylightSavingsOffset(BaseDuration self)`
`static Duration` | `getDays(java.lang.Integer self)`
`static TimeDuration` | `getHour(java.lang.Integer self)`
`static TimeDuration` | `getHours(java.lang.Integer self)`
`static TimeDuration` | `getMillisecond(java.lang.Integer self)`
`static TimeDuration` | `getMilliseconds(java.lang.Integer self)`
`static TimeDuration` | `getMinute(java.lang.Integer self)`
`static TimeDuration` | `getMinutes(java.lang.Integer self)`
`static DatumDependentDuration` | `getMonth(java.lang.Integer self)`
`static DatumDependentDuration` | `getMonths(java.lang.Integer self)`
`static Duration` | `getRelativeDaylightSavingsOffset(java.util.Date self, java.util.Date other)` Return a Duration representing the DST difference (if any) between two dates.
`static TimeDuration` | `getSecond(java.lang.Integer self)`
`static TimeDuration` | `getSeconds(java.lang.Integer self)`
`static java.util.TimeZone` | `getTimeZone(java.util.Date self)` Retrieves the default TimeZone for a date by using the default Locale settings.
`static Duration` | `getWeek(java.lang.Integer self)`
`static Duration` | `getWeeks(java.lang.Integer self)`
`static DatumDependentDuration` | `getYear(java.lang.Integer self)`
`static DatumDependentDuration` | `getYears(java.lang.Integer self)`
`static java.util.Date` | `minus(java.util.Date date, BaseDuration duration)`
`static TimeDuration` | `minus(java.util.Date lhs, java.util.Date rhs)` Subtract one date from the other.
`static java.util.Date` | `plus(java.util.Date date, BaseDuration duration)`

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Method Detail

### getDay

    public static Duration getDay(java.lang.Integer self)

### getDaylightSavingsOffset

    public static Duration getDaylightSavingsOffset(java.util.Date self)

  Get the DST offset (if any) for the default locale and the given date.
  Parameters:
    `self` - a Date
  Returns:
    the DST offset as a Duration.

### getDaylightSavingsOffset

    public static Duration getDaylightSavingsOffset(BaseDuration self)

### getDays

    public static Duration getDays(java.lang.Integer self)

### getHour

    public static TimeDuration getHour(java.lang.Integer self)

### getHours

    public static TimeDuration getHours(java.lang.Integer self)

### getMillisecond

    public static TimeDuration getMillisecond(java.lang.Integer self)

### getMilliseconds

    public static TimeDuration getMilliseconds(java.lang.Integer self)

### getMinute

    public static TimeDuration getMinute(java.lang.Integer self)

### getMinutes

    public static TimeDuration getMinutes(java.lang.Integer self)

### getMonth

    public static DatumDependentDuration getMonth(java.lang.Integer self)

### getMonths

    public static DatumDependentDuration getMonths(java.lang.Integer self)

### getRelativeDaylightSavingsOffset

    public static Duration getRelativeDaylightSavingsOffset(java.util.Date self, java.util.Date other)

  Return a Duration representing the DST difference (if any) between two dates. i.e. if one date is before the DST changeover, and the other date is after, the resulting duration will represent the DST offset.
  Parameters:
    `self` - a Date
    `other` - another Date
  Returns:
    a Duration

### getSecond

    public static TimeDuration getSecond(java.lang.Integer self)

### getSeconds

    public static TimeDuration getSeconds(java.lang.Integer self)

### getTimeZone

    public static java.util.TimeZone getTimeZone(java.util.Date self)

  Retrieves the default TimeZone for a date by using the default Locale settings.
  Parameters:
    `self` - a Date
  Returns:
    the TimeZone

### getWeek

    public static Duration getWeek(java.lang.Integer self)

### getWeeks

    public static Duration getWeeks(java.lang.Integer self)

### getYear

    public static DatumDependentDuration getYear(java.lang.Integer self)

### getYears

    public static DatumDependentDuration getYears(java.lang.Integer self)

### minus

    public static java.util.Date minus(java.util.Date date, BaseDuration duration)

### minus

    public static TimeDuration minus(java.util.Date lhs, java.util.Date rhs)

  Subtract one date from the other.
  Parameters:
    `lhs` - a Date
    `rhs` - another Date
  Returns:
    a Duration

### plus

    public static java.util.Date plus(java.util.Date date, BaseDuration duration)

Groovy Documentation