Package groovy.time
Class TimeCategory
java.lang.Object
groovy.time.TimeCategory
Deprecated.
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DurationDeprecated.Alias forgetDays(Integer).static DurationDeprecated.Gets the daylight savings offset for the supplied duration interpreted as a date.static DurationgetDaylightSavingsOffset(Date self) Deprecated.Get the DST offset (if any) for the default locale and the given date.static DurationDeprecated.Returns a day-based duration for the supplied number of days.static TimeDurationDeprecated.Alias forgetHours(Integer).static TimeDurationDeprecated.Returns an hour-based duration for the supplied number of hours.static TimeDurationgetMillisecond(Integer self) Deprecated.Alias forgetMilliseconds(Integer).static TimeDurationgetMilliseconds(Integer self) Deprecated.Returns a millisecond-based duration for the supplied number of milliseconds.static TimeDurationDeprecated.Alias forgetMinutes(Integer).static TimeDurationgetMinutes(Integer self) Deprecated.Returns a minute-based duration for the supplied number of minutes.static DatumDependentDurationDeprecated.Alias forgetMonths(Integer).static DatumDependentDurationDeprecated.Returns a month-based duration for the supplied number of months.static DurationgetRelativeDaylightSavingsOffset(Date self, Date other) Deprecated.Return a Duration representing the DST difference (if any) between two dates.static TimeDurationDeprecated.Alias forgetSeconds(Integer).static TimeDurationgetSeconds(Integer self) Deprecated.Returns a second-based duration for the supplied number of seconds.static TimeZonegetTimeZone(Date self) Deprecated.static DurationDeprecated.Alias forgetWeeks(Integer).static DurationDeprecated.Returns a week-based duration for the supplied number of weeks.static DatumDependentDurationDeprecated.Alias forgetYears(Integer).static DatumDependentDurationDeprecated.Returns a year-based duration for the supplied number of years.static Dateminus(Date date, BaseDuration duration) Deprecated.Subtracts a duration from a date.static TimeDurationDeprecated.Subtract one date from the other.static Dateplus(Date date, BaseDuration duration) Deprecated.Adds a duration to a date.
-
Constructor Details
-
TimeCategory
public TimeCategory()Deprecated.
-
-
Method Details
-
plus
Deprecated.Adds a duration to a date.- Parameters:
date- the base dateduration- the duration to add- Returns:
- the adjusted date
-
minus
Deprecated.Subtracts a duration from a date.- Parameters:
date- the base dateduration- the duration to subtract- Returns:
- the adjusted date
-
getTimeZone
Deprecated.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
-
getDaylightSavingsOffset
Deprecated.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
Deprecated.Gets the daylight savings offset for the supplied duration interpreted as a date.- Parameters:
self- the duration to inspect- Returns:
- the DST offset as a duration
-
getRelativeDaylightSavingsOffset
Deprecated.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 Dateother- another Date- Returns:
- a Duration
-
minus
Deprecated.Subtract one date from the other.- Parameters:
lhs- a Daterhs- another Date- Returns:
- a Duration
-
getMonths
Deprecated.Returns a month-based duration for the supplied number of months.- Parameters:
self- the number of months- Returns:
- the corresponding duration
-
getMonth
Deprecated.Alias forgetMonths(Integer).- Parameters:
self- the number of months- Returns:
- the corresponding duration
-
getYears
Deprecated.Returns a year-based duration for the supplied number of years.- Parameters:
self- the number of years- Returns:
- the corresponding duration
-
getYear
Deprecated.Alias forgetYears(Integer).- Parameters:
self- the number of years- Returns:
- the corresponding duration
-
getWeeks
Deprecated.Returns a week-based duration for the supplied number of weeks.- Parameters:
self- the number of weeks- Returns:
- the corresponding duration
-
getWeek
Deprecated.Alias forgetWeeks(Integer).- Parameters:
self- the number of weeks- Returns:
- the corresponding duration
-
getDays
Deprecated.Returns a day-based duration for the supplied number of days.- Parameters:
self- the number of days- Returns:
- the corresponding duration
-
getDay
Deprecated.Alias forgetDays(Integer).- Parameters:
self- the number of days- Returns:
- the corresponding duration
-
getHours
Deprecated.Returns an hour-based duration for the supplied number of hours.- Parameters:
self- the number of hours- Returns:
- the corresponding duration
-
getHour
Deprecated.Alias forgetHours(Integer).- Parameters:
self- the number of hours- Returns:
- the corresponding duration
-
getMinutes
Deprecated.Returns a minute-based duration for the supplied number of minutes.- Parameters:
self- the number of minutes- Returns:
- the corresponding duration
-
getMinute
Deprecated.Alias forgetMinutes(Integer).- Parameters:
self- the number of minutes- Returns:
- the corresponding duration
-
getSeconds
Deprecated.Returns a second-based duration for the supplied number of seconds.- Parameters:
self- the number of seconds- Returns:
- the corresponding duration
-
getSecond
Deprecated.Alias forgetSeconds(Integer).- Parameters:
self- the number of seconds- Returns:
- the corresponding duration
-
getMilliseconds
Deprecated.Returns a millisecond-based duration for the supplied number of milliseconds.- Parameters:
self- the number of milliseconds- Returns:
- the corresponding duration
-
getMillisecond
Deprecated.Alias forgetMilliseconds(Integer).- Parameters:
self- the number of milliseconds- Returns:
- the corresponding duration
-
org.apache.groovy.datetime.TimeCategory(producesjava.timetypes) ororg.apache.groovy.dateutil.TimeCategory(producesjava.util.Date). This legacy category is retained, unchanged, for backward compatibility.