org.joda.time.ReadableInstant |
Known Indirect Subclasses |
Defines an instant in the datetime continuum. This interface expresses the datetime as milliseconds from 1970-01-01T00:00:00Z.
The implementation of this interface may be mutable or immutable. This interface only gives access to retrieve data, never to change it.
Methods in your application should be defined using ReadableInstant
as a parameter if the method only wants to read the instant without needing to know
the specific datetime fields.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Compares this object with the specified object for ascending
millisecond instant order.
| |||||||||||
Compares this object with the specified object for equality based
on the millisecond instant and the Chronology.
| |||||||||||
Get the value of one of the fields of a datetime.
| |||||||||||
Gets the chronology of the instant.
| |||||||||||
Get the value as the number of milliseconds since
the epoch, 1970-01-01T00:00:00Z.
| |||||||||||
Gets the time zone of the instant from the chronology.
| |||||||||||
Gets a hash code for the instant that is compatible with the
equals method.
| |||||||||||
Is this instant after the instant passed in
comparing solely by millisecond.
| |||||||||||
Is this instant before the instant passed in
comparing solely by millisecond.
| |||||||||||
Is this instant equal to the instant passed in
comparing solely by millisecond.
| |||||||||||
Checks whether the field type specified is supported by this implementation.
| |||||||||||
Get the value as a simple immutable
Instant object. | |||||||||||
Get the value as a String in a recognisable ISO8601 format.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
java.lang.Comparable
|
Compares this object with the specified object for ascending millisecond instant order. This ordering is inconsistent with equals, as it ignores the Chronology.
All ReadableInstant instances are accepted.
readableInstant | a readable instant to check against |
---|
NullPointerException | if the object is null |
---|---|
ClassCastException | if the object type is not supported |
Compares this object with the specified object for equality based on the millisecond instant and the Chronology. All ReadableInstant instances are accepted.
To compare two instants for absolute time (ie. UTC milliseconds
ignoring the chronology), use isEqual(ReadableInstant)
or
compareTo(Object)
.
readableInstant | a readable instant to check against |
---|
Get the value of one of the fields of a datetime.
This method uses the chronology of the instant to obtain the value.
type | a field type, usually obtained from DateTimeFieldType, not null |
---|
IllegalArgumentException | if the field type is null |
---|
Gets the chronology of the instant.
The Chronology
provides conversion from the millisecond
value to meaningful fields in a particular calendar system.
Get the value as the number of milliseconds since the epoch, 1970-01-01T00:00:00Z.
Gets the time zone of the instant from the chronology.
Gets a hash code for the instant that is compatible with the equals method.
The formula used must be as follows:
((int) (getMillis() ^ (getMillis() >>> 32))) + (getChronology().hashCode())
Is this instant after the instant passed in comparing solely by millisecond.
instant | an instant to check against, null means now |
---|
Is this instant before the instant passed in comparing solely by millisecond.
instant | an instant to check against, null means now |
---|
Is this instant equal to the instant passed in comparing solely by millisecond.
instant | an instant to check against, null means now |
---|
Checks whether the field type specified is supported by this implementation.
field | the field type to check, may be null which returns false |
---|
Get the value as a simple immutable Instant
object.
This can be useful if you don't trust the implementation of the interface to be well-behaved, or to get a guaranteed immutable object.
Instant
object
Get the value as a String in a recognisable ISO8601 format.
The string output is in ISO8601 format to enable the String constructor to correctly parse it.