Duration is a time-based unit of time. While it may sound odd to phrase it that way, the wording was chosen to distinguish it from a date-based unit of time, which we'll look at next. In plain English, it's a measurement of time, such as 10 seconds, 1 hour, or 100 nanoseconds. Duration is measured in seconds, but there are a number of methods to get a representation of the duration in other units of measure, which are as follows:
- getNano(): This is Duration in nanosecods
- getSeconds(): This is Duration in seconds
- get(TemporalUnit): This is Duration in a unit of measure specified
There are also a variety of arithmetic methods, which are mentioned as follows:
- add/minus (int amount, TemporalUnit unit)
- add/minus (Duration)
- addDays ...