Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.time
Class TimeCategory

    java.lang.Object
      groovy.time.TimeCategory

    public class TimeCategory
    extends 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`

Constructor Summary
Constructor and Description
`TimeCategory()`

Method Summary
Modifier and Type | Method and Description
--- | ---
`static Duration` | `getDay(Integer self)`
`static Duration` | `getDaylightSavingsOffset(BaseDuration self)`
`static Duration` | `getDaylightSavingsOffset(Date self)` Get the DST offset (if any) for the default locale and the given date.
`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 Duration` | `getRelativeDaylightSavingsOffset(Date self, Date other)` Return a Duration representing the DST difference (if any) between two dates.
`static TimeDuration` | `getSecond(Integer self)`
`static TimeDuration` | `getSeconds(Integer self)`
`static TimeZone` | `getTimeZone(Date self)` Retrieves the default TimeZone for a date by using the default Locale settings.
`static Duration` | `getWeek(Integer self)`
`static Duration` | `getWeeks(Integer self)`
`static DatumDependentDuration` | `getYear(Integer self)`
`static DatumDependentDuration` | `getYears(Integer self)`
`static Date` | `minus(Date date, BaseDuration duration)`
`static TimeDuration` | `minus(Date lhs, Date rhs)` Subtract one date from the other.
`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 Detail

### TimeCategory

    public TimeCategory()

Method Detail

### plus

    public static Date plus(Date date,
                            BaseDuration duration)

### minus

    public static Date minus(Date date,
                             BaseDuration duration)

### getTimeZone

    public static TimeZone getTimeZone(Date self)

  Retrieves the default TimeZone for a date by using the default Locale settings.

  Parameters:
    `self` - a Date
  Returns:
    the TimeZone

### getDaylightSavingsOffset

    public static Duration getDaylightSavingsOffset(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)

### getRelativeDaylightSavingsOffset

    public static Duration getRelativeDaylightSavingsOffset(Date self,
                                                            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

### minus

    public static TimeDuration minus(Date lhs,
                                     Date rhs)

  Subtract one date from the other.

  Parameters:
    `lhs` - a Date
    `rhs` - another Date
  Returns:
    a Duration

### 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)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2003-2010 The Codehaus. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD