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:
  • Class
    Description
    Deprecated.
    Superseded by the quirk-free DSLs: org.apache.groovy.dateutil.TimeCategory (and its java.util.Date-based duration classes) or org.apache.groovy.datetime.TimeCategory (producing java.time types).
    Helper for computing dates relative to the current time.
    Deprecated.
    Superseded by org.apache.groovy.dateutil.DatumDependentDuration (the dequirked java.util.Date flavor) or java.time.Period.
    Deprecated.
    Superseded by org.apache.groovy.dateutil.Duration (the dequirked java.util.Date flavor) or java.time.Duration/java.time.Period.
    Deprecated.
    Use one of the quirk-free replacements instead: org.apache.groovy.datetime.TimeCategory (produces java.time types) or org.apache.groovy.dateutil.TimeCategory (produces java.util.Date).
    An immutable holder for the outcome of a timed execution: the value produced together with the elapsed time in nanoseconds.
    Deprecated.
    Superseded by org.apache.groovy.dateutil.TimeDatumDependentDuration (the dequirked java.util.Date flavor) or the java.time DSL in org.apache.groovy.datetime.TimeCategory.
    Deprecated.
    Superseded by org.apache.groovy.dateutil.TimeDuration (the dequirked java.util.Date flavor) or java.time.Duration.