use (groovy.time.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
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static Duration | |
| public static Duration | Returns: the DST offset as a Duration.a Date self)Get the DST offset (if any) for the default locale and the given date. |
| public static Duration | |
| public static Duration | |
| public static TimeDuration | |
| public static TimeDuration | |
| public static TimeDuration | |
| public static TimeDuration | |
| public static TimeDuration | |
| public static TimeDuration | |
| public static DatumDependentDuration | |
| public static DatumDependentDuration | |
| public static Duration | Returns: a Durationa Date self, Date another Date other)Return a Duration representing the DST difference (if any) between two dates. |
| public static TimeDuration | |
| public static TimeDuration | |
| public static TimeZone | Returns: the TimeZonea Date self)
Deprecated
Retrieves the default TimeZone for a date by using the default Locale
settings.
|
| public static Duration | |
| public static Duration | |
| public static DatumDependentDuration | |
| public static DatumDependentDuration | |
| public static Date | |
| public static TimeDuration | |
| public static Date |
| TimeCategory | back to summary |
|---|---|
| public TimeCategory() | |
| getDay | back to summary |
|---|---|
| public static Duration getDay(final Integer self) | |
| getDaylightSavingsOffset | back to summary |
|---|---|
| public static Duration getDaylightSavingsOffset(Date self) Get the DST offset (if any) for the default locale and the given date. | |
| getDaylightSavingsOffset | back to summary |
|---|---|
| public static Duration getDaylightSavingsOffset(BaseDuration self) | |
| getDays | back to summary |
|---|---|
| public static Duration getDays(final Integer self) | |
| getHour | back to summary |
|---|---|
| public static TimeDuration getHour(final Integer self) | |
| getHours | back to summary |
|---|---|
| public static TimeDuration getHours(final Integer self) | |
| getMillisecond | back to summary |
|---|---|
| public static TimeDuration getMillisecond(final Integer self) | |
| getMilliseconds | back to summary |
|---|---|
| public static TimeDuration getMilliseconds(final Integer self) | |
| getMinute | back to summary |
|---|---|
| public static TimeDuration getMinute(final Integer self) | |
| getMinutes | back to summary |
|---|---|
| public static TimeDuration getMinutes(final Integer self) | |
| getMonth | back to summary |
|---|---|
| public static DatumDependentDuration getMonth(final Integer self) | |
| getMonths | back to summary |
|---|---|
| public static DatumDependentDuration getMonths(final Integer self) | |
| getRelativeDaylightSavingsOffset | back to summary |
|---|---|
| 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. | |
| getSecond | back to summary |
|---|---|
| public static TimeDuration getSecond(final Integer self) | |
| getSeconds | back to summary |
|---|---|
| public static TimeDuration getSeconds(final Integer self) | |
| getTimeZone | back to summary |
|---|---|
| public static TimeZone getTimeZone(Date self)
Deprecated
Retrieves the default TimeZone for a date by using the default Locale
settings. Recommended that you use | |
| getWeek | back to summary |
|---|---|
| public static Duration getWeek(final Integer self) | |
| getWeeks | back to summary |
|---|---|
| public static Duration getWeeks(final Integer self) | |
| getYear | back to summary |
|---|---|
| public static DatumDependentDuration getYear(final Integer self) | |
| getYears | back to summary |
|---|---|
| public static DatumDependentDuration getYears(final Integer self) | |
| minus | back to summary |
|---|---|
| public static Date minus(final Date date, final BaseDuration duration) | |
| minus | back to summary |
|---|---|
| public static TimeDuration minus(final Date lhs, final Date rhs) Subtract one date from the other.
| |
| plus | back to summary |
|---|---|
| public static Date plus(final Date date, final BaseDuration duration) | |