Package groovy.time
Class TimeCategory
java.lang.Object
groovy.time.TimeCategory
Apply a number of methods to allow convenient Date/Time manipulation,such as:
 
 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
 }
 - See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic Durationstatic Durationstatic DurationgetDaylightSavingsOffset(Date self) Get the DST offset (if any) for the default locale and the given date.static Durationstatic TimeDurationstatic TimeDurationstatic TimeDurationgetMillisecond(Integer self) static TimeDurationgetMilliseconds(Integer self) static TimeDurationstatic TimeDurationgetMinutes(Integer self) static DatumDependentDurationstatic DatumDependentDurationstatic DurationgetRelativeDaylightSavingsOffset(Date self, Date other) Return a Duration representing the DST difference (if any) between two dates.static TimeDurationstatic TimeDurationgetSeconds(Integer self) static TimeZonegetTimeZone(Date self) Deprecated.static Durationstatic Durationstatic DatumDependentDurationstatic DatumDependentDurationstatic Dateminus(Date date, BaseDuration duration) static TimeDurationSubtract one date from the other.static Dateplus(Date date, BaseDuration duration) 
- 
Constructor Details- 
TimeCategorypublic TimeCategory()
 
- 
- 
Method Details- 
plus
- 
minus
- 
getTimeZoneDeprecated.Retrieves the default TimeZone for a date by using the default Locale settings. Recommended that you useTimeZone.getDefault()instead.- Parameters:
- self- a Date
- Returns:
- the TimeZone
 
- 
getDaylightSavingsOffsetGet 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
- 
getRelativeDaylightSavingsOffsetReturn 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
 
- 
minusSubtract one date from the other.- Parameters:
- lhs- a Date
- rhs- another Date
- Returns:
- a Duration
 
- 
getMonths
- 
getMonth
- 
getYears
- 
getYear
- 
getWeeks
- 
getWeek
- 
getDays
- 
getDay
- 
getHours
- 
getHour
- 
getMinutes
- 
getMinute
- 
getSeconds
- 
getSecond
- 
getMilliseconds
- 
getMillisecond
 
-