# ChronoUnit

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Enums](https://developer.android.com/reference/java/time/temporal/ChronoUnit#enumconstants)\|[Methods](https://developer.android.com/reference/java/time/temporal/ChronoUnit#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/java/time/temporal/ChronoUnit#inhmethods)  

# ChronoUnit

`
public

final

enum
ChronoUnit
`  
`


``

extends `[Enum](https://developer.android.com/reference/java/lang/Enum)`<`[ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit)`>


``


implements

`[TemporalUnit](https://developer.android.com/reference/java/time/temporal/TemporalUnit)`


`

|---|---|-------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [java.lang.Enum](https://developer.android.com/reference/java/lang/Enum)\<[java.time.temporal.ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit)\> ||
|   | ↳ | java.time.temporal.ChronoUnit |

<br />

*** ** * ** ***

A standard set of date periods units.

This set of units provide unit-based access to manipulate a date, time or date-time. The standard set of units can be extended by implementing[TemporalUnit](https://developer.android.com/reference/java/time/temporal/TemporalUnit).

These units are intended to be applicable in multiple calendar systems. For example, most non-ISO calendar systems define units of years, months and days, just with slightly different rules. The documentation of each unit explains how it operates.

## Summary

|                                                                                   ### Enum values                                                                                   ||
|-------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `CENTURIES` Unit that represents the concept of a century.                                     |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `DAYS` Unit that represents the concept of a day.                                              |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `DECADES` Unit that represents the concept of a decade.                                        |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `ERAS` Unit that represents the concept of an era.                                             |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `FOREVER` Artificial unit that represents the concept of forever.                              |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `HALF_DAYS` Unit that represents the concept of half a day, as used in AM/PM.                  |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `HOURS` Unit that represents the concept of an hour.                                           |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `MICROS` Unit that represents the concept of a microsecond.                                    |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `MILLENNIA` Unit that represents the concept of a millennium.                                  |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `MILLIS` Unit that represents the concept of a millisecond.                                    |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `MINUTES` Unit that represents the concept of a minute.                                        |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `MONTHS` Unit that represents the concept of a month.                                          |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `NANOS` Unit that represents the concept of a nanosecond, the smallest supported unit of time. |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `SECONDS` Unit that represents the concept of a second.                                        |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `WEEKS` Unit that represents the concept of a week.                                            |
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | `YEARS` Unit that represents the concept of a year.                                            |

|                                                                                                                                                                                                                                                            ### Public methods                                                                                                                                                                                                                                                             ||
|-------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` <R extends `[Temporal](https://developer.android.com/reference/java/time/temporal/Temporal)`> R`    | ` `[addTo](https://developer.android.com/reference/java/time/temporal/ChronoUnit#addTo(R,%20long))`(R temporal, long amount) ` Returns a copy of the specified temporal object with the specified period added.                                                                                                                                                                                                                    |
| ` long`                                                                                               | ` `[between](https://developer.android.com/reference/java/time/temporal/ChronoUnit#between(java.time.temporal.Temporal,%20java.time.temporal.Temporal))`(`[Temporal](https://developer.android.com/reference/java/time/temporal/Temporal)` temporal1Inclusive, `[Temporal](https://developer.android.com/reference/java/time/temporal/Temporal)` temporal2Exclusive) ` Calculates the amount of time between two temporal objects. |
| ` `[Duration](https://developer.android.com/reference/java/time/Duration)                             | ` `[getDuration](https://developer.android.com/reference/java/time/temporal/ChronoUnit#getDuration())`() ` Gets the estimated duration of this unit in the ISO calendar system.                                                                                                                                                                                                                                                    |
| ` boolean`                                                                                            | ` `[isDateBased](https://developer.android.com/reference/java/time/temporal/ChronoUnit#isDateBased())`() ` Checks if this unit is a date unit.                                                                                                                                                                                                                                                                                     |
| ` boolean`                                                                                            | ` `[isDurationEstimated](https://developer.android.com/reference/java/time/temporal/ChronoUnit#isDurationEstimated())`() ` Checks if the duration of the unit is an estimate.                                                                                                                                                                                                                                                      |
| ` boolean`                                                                                            | ` `[isSupportedBy](https://developer.android.com/reference/java/time/temporal/ChronoUnit#isSupportedBy(java.time.temporal.Temporal))`(`[Temporal](https://developer.android.com/reference/java/time/temporal/Temporal)` temporal) ` Checks if this unit is supported by the specified temporal object.                                                                                                                             |
| ` boolean`                                                                                            | ` `[isTimeBased](https://developer.android.com/reference/java/time/temporal/ChronoUnit#isTimeBased())`() ` Checks if this unit is a time unit.                                                                                                                                                                                                                                                                                     |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                 | ` `[toString](https://developer.android.com/reference/java/time/temporal/ChronoUnit#toString())`() ` Returns the name of this enum constant, as contained in the declaration.                                                                                                                                                                                                                                                      |
| ` static `[ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit)         | ` `[valueOf](https://developer.android.com/reference/java/time/temporal/ChronoUnit#valueOf(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` name) `                                                                                                                                                                                                                                        |
| ` static final `[ChronoUnit[]](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | ` `[values](https://developer.android.com/reference/java/time/temporal/ChronoUnit#values())`() `                                                                                                                                                                                                                                                                                                                                   |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Enum](https://developer.android.com/reference/java/lang/Enum)` ` |--------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` final `[Object](https://developer.android.com/reference/java/lang/Object)                                                                                        | ` `[clone](https://developer.android.com/reference/java/lang/Enum#clone())`() ` Throws CloneNotSupportedException.                                                                                                                                                                                                                                                 | | ` final int`                                                                                                                                                       | ` `[compareTo](https://developer.android.com/reference/java/lang/Enum#compareTo(E))`(`[ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit)` o) ` Compares this enum with the specified object for order.                                                                                                                            | | ` final boolean`                                                                                                                                                   | ` `[equals](https://developer.android.com/reference/java/lang/Enum#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` other) ` Returns true if the specified object is equal to this enum constant.                                                                                                                   | | ` final void`                                                                                                                                                      | ` `[finalize](https://developer.android.com/reference/java/lang/Enum#finalize())`() ` enum classes cannot have finalize methods.                                                                                                                                                                                                                                   | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<`[ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit)`>` | ` `[getDeclaringClass](https://developer.android.com/reference/java/lang/Enum#getDeclaringClass())`() ` Returns the Class object corresponding to this enum constant's enum type.                                                                                                                                                                                  | | ` final int`                                                                                                                                                       | ` `[hashCode](https://developer.android.com/reference/java/lang/Enum#hashCode())`() ` Returns a hash code for this enum constant.                                                                                                                                                                                                                                  | | ` final `[String](https://developer.android.com/reference/java/lang/String)                                                                                        | ` `[name](https://developer.android.com/reference/java/lang/Enum#name())`() ` Returns the name of this enum constant, exactly as declared in its enum declaration.                                                                                                                                                                                                 | | ` final int`                                                                                                                                                       | ` `[ordinal](https://developer.android.com/reference/java/lang/Enum#ordinal())`() ` Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).                                                                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String)                                                                                              | ` `[toString](https://developer.android.com/reference/java/lang/Enum#toString())`() ` Returns the name of this enum constant, as contained in the declaration.                                                                                                                                                                                                     | | ` static <T extends `[Enum](https://developer.android.com/reference/java/lang/Enum)`<T>> T`                                                                        | ` `[valueOf](https://developer.android.com/reference/java/lang/Enum#valueOf(java.lang.Class<T>,%20java.lang.String))`(`[Class](https://developer.android.com/reference/java/lang/Class)`<T> enumClass, `[String](https://developer.android.com/reference/java/lang/String)` name) ` Returns the enum constant of the specified enum class with the specified name. | ||
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||
| From interface` `[java.lang.Comparable](https://developer.android.com/reference/java/lang/Comparable)` ` |-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int` | ` `[compareTo](https://developer.android.com/reference/java/lang/Comparable#compareTo(T))`(`[ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit)` o) ` Compares this object with the specified object for order. | ||
| From interface` `[java.time.temporal.TemporalUnit](https://developer.android.com/reference/java/time/temporal/TemporalUnit)` ` |-------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract <R extends `[Temporal](https://developer.android.com/reference/java/time/temporal/Temporal)`> R` | ` `[addTo](https://developer.android.com/reference/java/time/temporal/TemporalUnit#addTo(R,%20long))`(R temporal, long amount) ` Returns a copy of the specified temporal object with the specified period added.                                                                                                                                                                                                                    | | ` abstract long`                                                                                            | ` `[between](https://developer.android.com/reference/java/time/temporal/TemporalUnit#between(java.time.temporal.Temporal,%20java.time.temporal.Temporal))`(`[Temporal](https://developer.android.com/reference/java/time/temporal/Temporal)` temporal1Inclusive, `[Temporal](https://developer.android.com/reference/java/time/temporal/Temporal)` temporal2Exclusive) ` Calculates the amount of time between two temporal objects. | | ` abstract `[Duration](https://developer.android.com/reference/java/time/Duration)                          | ` `[getDuration](https://developer.android.com/reference/java/time/temporal/TemporalUnit#getDuration())`() ` Gets the duration of this unit, which may be an estimate.                                                                                                                                                                                                                                                               | | ` abstract boolean`                                                                                         | ` `[isDateBased](https://developer.android.com/reference/java/time/temporal/TemporalUnit#isDateBased())`() ` Checks if this unit represents a component of a date.                                                                                                                                                                                                                                                                   | | ` abstract boolean`                                                                                         | ` `[isDurationEstimated](https://developer.android.com/reference/java/time/temporal/TemporalUnit#isDurationEstimated())`() ` Checks if the duration of the unit is an estimate.                                                                                                                                                                                                                                                      | | ` default boolean`                                                                                          | ` `[isSupportedBy](https://developer.android.com/reference/java/time/temporal/TemporalUnit#isSupportedBy(java.time.temporal.Temporal))`(`[Temporal](https://developer.android.com/reference/java/time/temporal/Temporal)` temporal) ` Checks if this unit is supported by the specified temporal object.                                                                                                                             | | ` abstract boolean`                                                                                         | ` `[isTimeBased](https://developer.android.com/reference/java/time/temporal/TemporalUnit#isTimeBased())`() ` Checks if this unit represents a component of a time.                                                                                                                                                                                                                                                                   | | ` abstract `[String](https://developer.android.com/reference/java/lang/String)                              | ` `[toString](https://developer.android.com/reference/java/time/temporal/TemporalUnit#toString())`() ` Gets a descriptive name for the unit.                                                                                                                                                                                                                                                                                         | ||

## Enum values

### CENTURIES

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit CENTURIES
```

Unit that represents the concept of a century. For the ISO calendar system, it is equal to 100 years.

When used with other calendar systems it must correspond to an integral number of days and is normally an integral number of years.

<br />

### DAYS

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit DAYS
```

Unit that represents the concept of a day. For the ISO calendar system, it is the standard day from midnight to midnight. The estimated duration of a day is`24 Hours`.

When used with other calendar systems it must correspond to the day defined by the rising and setting of the Sun on Earth. It is not required that days begin at midnight - when converting between calendar systems, the date should be equivalent at midday.

<br />

### DECADES

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit DECADES
```

Unit that represents the concept of a decade. For the ISO calendar system, it is equal to 10 years.

When used with other calendar systems it must correspond to an integral number of days and is normally an integral number of years.

<br />

### ERAS

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit ERAS
```

Unit that represents the concept of an era. The ISO calendar system doesn't have eras thus it is impossible to add an era to a date or date-time. The estimated duration of the era is artificially defined as`1,000,000,000 Years`.

When used with other calendar systems there are no restrictions on the unit.

<br />

### FOREVER

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit FOREVER
```

Artificial unit that represents the concept of forever. This is primarily used with[TemporalField](https://developer.android.com/reference/java/time/temporal/TemporalField)to represent unbounded fields such as the year or era. The estimated duration of this unit is artificially defined as the largest duration supported by[Duration](https://developer.android.com/reference/java/time/Duration).

<br />

### HALF_DAYS

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit HALF_DAYS
```

Unit that represents the concept of half a day, as used in AM/PM. For the ISO calendar system, it is equal to 12 hours.

<br />

### HOURS

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit HOURS
```

Unit that represents the concept of an hour. For the ISO calendar system, it is equal to 60 minutes.

<br />

### MICROS

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit MICROS
```

Unit that represents the concept of a microsecond. For the ISO calendar system, it is equal to the 1,000,000th part of the second unit.

<br />

### MILLENNIA

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit MILLENNIA
```

Unit that represents the concept of a millennium. For the ISO calendar system, it is equal to 1000 years.

When used with other calendar systems it must correspond to an integral number of days and is normally an integral number of years.

<br />

### MILLIS

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit MILLIS
```

Unit that represents the concept of a millisecond. For the ISO calendar system, it is equal to the 1000th part of the second unit.

<br />

### MINUTES

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit MINUTES
```

Unit that represents the concept of a minute. For the ISO calendar system, it is equal to 60 seconds.

<br />

### MONTHS

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit MONTHS
```

Unit that represents the concept of a month. For the ISO calendar system, the length of the month varies by month-of-year. The estimated duration of a month is one twelfth of`365.2425 Days`.

When used with other calendar systems it must correspond to an integral number of days.

<br />

### NANOS

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit NANOS
```

Unit that represents the concept of a nanosecond, the smallest supported unit of time. For the ISO calendar system, it is equal to the 1,000,000,000th part of the second unit.

<br />

### SECONDS

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit SECONDS
```

Unit that represents the concept of a second. For the ISO calendar system, it is equal to the second in the SI system of units, except around a leap-second.

<br />

### WEEKS

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit WEEKS
```

Unit that represents the concept of a week. For the ISO calendar system, it is equal to 7 days.

When used with other calendar systems it must correspond to an integral number of days.

<br />

### YEARS

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final ChronoUnit YEARS
```

Unit that represents the concept of a year. For the ISO calendar system, it is equal to 12 months. The estimated duration of a year is`365.2425 Days`.

When used with other calendar systems it must correspond to an integral number of days or months roughly equal to a year defined by the passage of the Earth around the Sun.

<br />

## Public methods

### addTo

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public R addTo (R temporal, 
                long amount)
```

Returns a copy of the specified temporal object with the specified period added.

The period added is a multiple of this unit. For example, this method could be used to add "3 days" to a date by calling this method on the instance representing "days", passing the date and the period "3". The period to be added may be negative, which is equivalent to subtraction.

There are two equivalent ways of using this method. The first is to invoke this method directly. The second is to use[Temporal.plus(long, TemporalUnit)](https://developer.android.com/reference/java/time/temporal/Temporal#plus(long,%20java.time.temporal.TemporalUnit)):  

```
   // these two lines are equivalent, but the second approach is recommended
   temporal = thisUnit.addTo(temporal);
   temporal = temporal.plus(thisUnit);
 
```
It is recommended to use the second approach,`plus(TemporalUnit)`, as it is a lot clearer to read in code.

Implementations should perform any queries or calculations using the units available in[ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit)or the fields available in[ChronoField](https://developer.android.com/reference/java/time/temporal/ChronoField). If the unit is not supported an`UnsupportedTemporalTypeException`must be thrown.

Implementations must not alter the specified temporal object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.

<br />

|                                   Parameters                                    ||
|------------|---------------------------------------------------------------------|
| `temporal` | `R`: the temporal object to adjust, not null <br />                 |
| `amount`   | `long`: the amount of this unit to add, positive or negative <br /> |

|                      Returns                       ||
|-----|-----------------------------------------------|
| `R` | the adjusted temporal object, not null <br /> |

### between

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public long between (Temporal temporal1Inclusive, 
                Temporal temporal2Exclusive)
```

Calculates the amount of time between two temporal objects.

This calculates the amount in terms of this unit. The start and end points are supplied as temporal objects and must be of compatible types. The implementation will convert the second type to be an instance of the first type before the calculating the amount. The result will be negative if the end is before the start. For example, the amount in hours between two temporal objects can be calculated using`HOURS.between(startTime, endTime)`.

The calculation returns a whole number, representing the number of complete units between the two temporals. For example, the amount in hours between the times 11:30 and 13:29 will only be one hour as it is one minute short of two hours.

There are two equivalent ways of using this method. The first is to invoke this method directly. The second is to use[Temporal.until(Temporal, TemporalUnit)](https://developer.android.com/reference/java/time/temporal/Temporal#until(java.time.temporal.Temporal,%20java.time.temporal.TemporalUnit)):  

```
   // these two lines are equivalent
   between = thisUnit.between(start, end);
   between = start.until(end, thisUnit);
 
```
The choice should be made based on which makes the code more readable.

For example, this method allows the number of days between two dates to be calculated:  

```
  long daysBetween = DAYS.between(start, end);
  // or alternatively
  long daysBetween = start.until(end, DAYS);
 
```

Implementations should perform any queries or calculations using the units available in[ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit)or the fields available in[ChronoField](https://developer.android.com/reference/java/time/temporal/ChronoField). If the unit is not supported an`UnsupportedTemporalTypeException`must be thrown. Implementations must not alter the specified temporal objects.

<br />

|                                       Parameters                                        ||
|----------------------|-------------------------------------------------------------------|
| `temporal1Inclusive` | `Temporal`: the base temporal object, not null <br />             |
| `temporal2Exclusive` | `Temporal`: the other temporal object, exclusive, not null <br /> |

|                                                                                             Returns                                                                                             ||
|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `long` | the amount of time between temporal1Inclusive and temporal2Exclusive in terms of this unit; positive if temporal2Exclusive is later than temporal1Inclusive, negative if earlier <br /> |

### getDuration

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Duration getDuration ()
```

Gets the estimated duration of this unit in the ISO calendar system.

All of the units in this class have an estimated duration. Days vary due to daylight saving time, while months have different lengths.

<br />

|                                                           Returns                                                            ||
|------------------------------------------------------------------------|------------------------------------------------------|
| [Duration](https://developer.android.com/reference/java/time/Duration) | the estimated duration of this unit, not null <br /> |

### isDateBased

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isDateBased ()
```

Checks if this unit is a date unit.

All units from days to eras inclusive are date-based. Time-based units and`FOREVER`return false.

<br />

|                           Returns                           ||
|-----------|--------------------------------------------------|
| `boolean` | true if a date unit, false if a time unit <br /> |

### isDurationEstimated

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isDurationEstimated ()
```

Checks if the duration of the unit is an estimate.

All time units in this class are considered to be accurate, while all date units in this class are considered to be estimated.

This definition ignores leap seconds, but considers that Days vary due to daylight saving time and months have different lengths.

<br />

|                                Returns                                 ||
|-----------|-------------------------------------------------------------|
| `boolean` | true if the duration is estimated, false if accurate <br /> |

### isSupportedBy

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isSupportedBy (Temporal temporal)
```

Checks if this unit is supported by the specified temporal object.

This checks that the implementing date-time can add/subtract this unit. This can be used to avoid throwing an exception.

This default implementation derives the value using[Temporal.plus(long, TemporalUnit)](https://developer.android.com/reference/java/time/temporal/Temporal#plus(long,%20java.time.temporal.TemporalUnit)).

<br />

|                              Parameters                               ||
|------------|-----------------------------------------------------------|
| `temporal` | `Temporal`: the temporal object to check, not null <br /> |

|                     Returns                     ||
|-----------|--------------------------------------|
| `boolean` | true if the unit is supported <br /> |

### isTimeBased

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isTimeBased ()
```

Checks if this unit is a time unit.

All units from nanos to half-days inclusive are time-based. Date-based units and`FOREVER`return false.

<br />

|                           Returns                           ||
|-----------|--------------------------------------------------|
| `boolean` | true if a time unit, false if a date unit <br /> |

### toString

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String toString ()
```

Returns the name of this enum constant, as contained in the declaration. This method may be overridden, though it typically isn't necessary or desirable. An enum class should override this method when a more "programmer-friendly" string form exists.

<br />

|                                                  Returns                                                  ||
|--------------------------------------------------------------------|---------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | the name of this enum constant <br /> |

### valueOf

```
public static ChronoUnit valueOf (String name)
```

<br />

<br />

|       Parameters        ||
|--------|-----------------|
| `name` | `String` <br /> |

|                                           Returns                                           ||
|-------------------------------------------------------------------------------------|--------|
| [ChronoUnit](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | <br /> |

### values

```
public static final ChronoUnit[] values ()
```

<br />

<br />

|                                            Returns                                            ||
|---------------------------------------------------------------------------------------|--------|
| [ChronoUnit[]](https://developer.android.com/reference/java/time/temporal/ChronoUnit) | <br /> |