Package groovy.time
Class Duration
java.lang.Object
groovy.time.BaseDuration
groovy.time.Duration
- All Implemented Interfaces:
- Comparable<BaseDuration>
- Direct Known Subclasses:
- TimeDuration
Duration represents time periods which have values independent of the context.
 So, whilst we can't say how long a month is without knowing the year and the name of the month,
 we know how long a day is independent of the date.
 
This is not 100% true for days. Days can actually be 23, 24 or 25 hours long (due to daylight saving adjustments.)
If you ask Duration to convert itself to milliseconds then it will work on the basis of 24 hours in a day. If you add or subtract it from a date it will take daylight saving into account.
- 
Nested Class SummaryNested classes/interfaces inherited from class groovy.time.BaseDurationBaseDuration.From
- 
Field Summary
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiongetAgo()getFrom()minus(TimeDuration rhs) plus(TimeDuration rhs) longMethods inherited from class groovy.time.BaseDurationcompareTo, getDays, getHours, getMillis, getMinutes, getMonths, getSeconds, getYears, plus, toString
- 
Constructor Details- 
Durationpublic Duration(int days, int hours, int minutes, int seconds, int millis) 
 
- 
- 
Method Details- 
plus
- 
plus
- 
plus
- 
minus
- 
minus
- 
minus
- 
minus
- 
toMillisecondspublic long toMilliseconds()- Specified by:
- toMillisecondsin class- BaseDuration
 
- 
getAgo- Specified by:
- getAgoin class- BaseDuration
 
- 
getFrom- Specified by:
- getFromin class- BaseDuration
 
 
-