groovy.time
public class TimeCategory extends 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(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) |
public static Date plus(Date date, BaseDuration duration)
public static Date minus(Date date, BaseDuration duration)
public static TimeZone getTimeZone(Date self)
self
- a Datepublic static Duration getDaylightSavingsOffset(Date self)
self
- a Datepublic static Duration getDaylightSavingsOffset(BaseDuration self)
public static Duration getRelativeDaylightSavingsOffset(Date self, Date other)
self
- a Dateother
- another Datepublic static TimeDuration minus(Date lhs, Date rhs)
lhs
- a Daterhs
- another Datepublic static DatumDependentDuration getMonths(Integer self)
public static DatumDependentDuration getMonth(Integer self)
public static DatumDependentDuration getYears(Integer self)
public static DatumDependentDuration getYear(Integer self)
public static TimeDuration getHours(Integer self)
public static TimeDuration getHour(Integer self)
public static TimeDuration getMinutes(Integer self)
public static TimeDuration getMinute(Integer self)
public static TimeDuration getSeconds(Integer self)
public static TimeDuration getSecond(Integer self)
public static TimeDuration getMilliseconds(Integer self)
public static TimeDuration getMillisecond(Integer self)