public class TimeCategory
extends java.lang.Object
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 }
BaseDuration
Constructor and Description |
---|
TimeCategory() |
Modifier and Type | Method and Description |
---|---|
static Duration |
getDay(java.lang.Integer self) |
static Duration |
getDaylightSavingsOffset(BaseDuration self) |
static Duration |
getDaylightSavingsOffset(java.util.Date self)
Get the DST offset (if any) for the default locale and the given date.
|
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)
Deprecated.
|
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) |
public static java.util.Date plus(java.util.Date date, BaseDuration duration)
public static java.util.Date minus(java.util.Date date, BaseDuration duration)
@Deprecated public static java.util.TimeZone getTimeZone(java.util.Date self)
TimeZone.getDefault()
instead.self
- a Datepublic static Duration getDaylightSavingsOffset(java.util.Date self)
self
- a Datepublic static Duration getDaylightSavingsOffset(BaseDuration self)
public static Duration getRelativeDaylightSavingsOffset(java.util.Date self, java.util.Date other)
self
- a Dateother
- another Datepublic static TimeDuration minus(java.util.Date lhs, java.util.Date rhs)
lhs
- a Daterhs
- another Datepublic static DatumDependentDuration getMonths(java.lang.Integer self)
public static DatumDependentDuration getMonth(java.lang.Integer self)
public static DatumDependentDuration getYears(java.lang.Integer self)
public static DatumDependentDuration getYear(java.lang.Integer self)
public static Duration getWeeks(java.lang.Integer self)
public static Duration getWeek(java.lang.Integer self)
public static Duration getDays(java.lang.Integer self)
public static Duration getDay(java.lang.Integer self)
public static TimeDuration getHours(java.lang.Integer self)
public static TimeDuration getHour(java.lang.Integer self)
public static TimeDuration getMinutes(java.lang.Integer self)
public static TimeDuration getMinute(java.lang.Integer self)
public static TimeDuration getSeconds(java.lang.Integer self)
public static TimeDuration getSecond(java.lang.Integer self)
public static TimeDuration getMilliseconds(java.lang.Integer self)
public static TimeDuration getMillisecond(java.lang.Integer self)