Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/icu/util/DateInterval#pubctors) \| [Methods](https://developer.android.com/reference/android/icu/util/DateInterval#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/icu/util/DateInterval#inhmethods)

# DateInterval

*** ** * ** ***


`
public

final

class
DateInterval
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/java/io/Serializable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.icu.util.DateInterval |

<br />

*** ** * ** ***

This class represents date interval.
It is a pair of long representing from date 1 to date 2.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/icu/util/DateInterval#DateInterval(long,%20long)(long from, long to) ` Constructor given from date and to date. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/icu/util/DateInterval#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object a) ` Override equals |
| ` long` | ` https://developer.android.com/reference/android/icu/util/DateInterval#getFromDate()() ` Get the from date. |
| ` long` | ` https://developer.android.com/reference/android/icu/util/DateInterval#getToDate()() ` Get the to date. |
| ` int` | ` https://developer.android.com/reference/android/icu/util/DateInterval#hashCode()() ` Override hashcode |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/icu/util/DateInterval#toString()() ` Override toString |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` 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 https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` 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` | ` 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` | ` 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*. | ||

## Public constructors

### DateInterval

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

```
public DateInterval (long from, 
                long to)
```

Constructor given from date and to date.

<br />

| Parameters ||
|---|---|
| `from` | `long`: The from date in date interval. <br /> |
| `to` | `long`: The to date in date interval. <br /> |

## Public methods

### equals

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

```
public boolean equals (Object a)
```

Override equals

<br />

| Parameters ||
|---|---|
| `a` | `Object`: the reference object with which to compare. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### getFromDate

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

```
public long getFromDate ()
```

Get the from date.

<br />

| Returns ||
|---|---|
| `long` | the from date in dateInterval. <br /> |

### getToDate

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

```
public long getToDate ()
```

Get the to date.

<br />

| Returns ||
|---|---|
| `long` | the to date in dateInterval. <br /> |

### hashCode

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

```
public int hashCode ()
```

Override hashcode

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### toString

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

```
public String toString ()
```

Override toString

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |