Package groovy.time
package groovy.time
Classes for easily manipulating Dates and times. While
java.util.Date has GDK methods for adding or subtracting days,
this is not so useful for different durations of time.
TimeCategory creates a simple internal DSL
for manipulating dates and times in a clean and precise fashion.
Examples
use ( TimeCategory ) {
// application on numbers:
println 1.minute.from.now
println 10.days.ago
// application on dates
def someDate = new Date()
println someDate - 3.months
}- See Also:
-
ClassDescriptionDeprecated.Helper for computing dates relative to the current time.Deprecated.Superseded by
org.apache.groovy.dateutil.DatumDependentDuration(the dequirkedjava.util.Dateflavor) orjava.time.Period.Deprecated.Superseded byorg.apache.groovy.dateutil.Duration(the dequirkedjava.util.Dateflavor) orjava.time.Duration/java.time.Period.Deprecated.Use one of the quirk-free replacements instead:org.apache.groovy.datetime.TimeCategory(producesjava.timetypes) ororg.apache.groovy.dateutil.TimeCategory(producesjava.util.Date).Timed<T>An immutable holder for the outcome of a timed execution: the value produced together with the elapsed time in nanoseconds.Deprecated.Superseded byorg.apache.groovy.dateutil.TimeDatumDependentDuration(the dequirkedjava.util.Dateflavor) or thejava.timeDSL inorg.apache.groovy.datetime.TimeCategory.Deprecated.Superseded byorg.apache.groovy.dateutil.TimeDuration(the dequirkedjava.util.Dateflavor) orjava.time.Duration.
org.apache.groovy.dateutil.TimeCategory(and itsjava.util.Date-based duration classes) ororg.apache.groovy.datetime.TimeCategory(producingjava.timetypes).