java.lang.Object | |
↳ | org.joda.time.base.AbstractInstant |
Known Direct Subclasses |
Known Indirect Subclasses |
AbstractInstant provides the common behaviour for instant classes.
This class has no concept of a chronology, all methods work on the millisecond instant.
This class should generally not be used directly by API users. The
ReadableInstant
interface should be used when different
kinds of date/time objects are to be referenced.
Whenever you want to implement ReadableInstant
you should
extend this class.
AbstractInstant itself is thread-safe and immutable, but subclasses may be mutable and not thread-safe.
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructor.
|
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, chronology and time zone.
| |||||||||||
Get the value of one of the fields of a datetime using the chronology of the instant.
| |||||||||||
Get the value of one of the fields of a datetime.
| |||||||||||
Gets the time zone of the instant from the chronology.
| |||||||||||
Gets a hash code for the instant as defined in
ReadableInstant . | |||||||||||
Is this instant after the millisecond instant passed in
comparing solely by millisecond.
| |||||||||||
Is this instant after the instant passed in
comparing solely by millisecond.
| |||||||||||
Is this instant after the current instant
comparing solely by millisecond.
| |||||||||||
Is this instant before the millisecond instant passed in
comparing solely by millisecond.
| |||||||||||
Is this instant before the instant passed in
comparing solely by millisecond.
| |||||||||||
Is this instant before the current instant
comparing solely by millisecond.
| |||||||||||
Is this instant equal to the instant passed in
comparing solely by millisecond.
| |||||||||||
Is this instant equal to the millisecond instant passed in
comparing solely by millisecond.
| |||||||||||
Is this instant equal to the current instant
comparing solely by millisecond.
| |||||||||||
Checks if the field type specified is supported by this instant and chronology.
| |||||||||||
Get the date time as a
java.util.Date . | |||||||||||
Get this object as a DateTime using the given chronology and its zone.
| |||||||||||
Get this object as a DateTime using the same chronology but a different zone.
| |||||||||||
Get this object as a DateTime in the same zone.
| |||||||||||
Get this object as a DateTime using ISOChronology in the same zone.
| |||||||||||
Get this object as an Instant.
| |||||||||||
Get this object as a MutableDateTime in the same zone.
| |||||||||||
Get this object as a MutableDateTime using the given chronology and its zone.
| |||||||||||
Get this object as a MutableDateTime using the same chronology but a different zone.
| |||||||||||
Get this object as a MutableDateTime using ISOChronology in the same zone.
| |||||||||||
Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZZ).
| |||||||||||
Uses the specified formatter to convert this partial to a String.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Comparable
| |||||||||||
From interface
org.joda.time.ReadableInstant
|
Constructor.
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.
instant | 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, chronology and time zone.
Two objects which represent the same instant in time, but are in
different time zones (based on time zone id), will be considered to
be different. Only two objects with the same DateTimeZone
,
Chronology
and instant are equal.
See isEqual(ReadableInstant)
for an equals method that
ignores the Chronology and time zone.
All ReadableInstant instances are accepted.
readableInstant | a readable instant to check against |
---|
Get the value of one of the fields of a datetime using the chronology of the instant.
This method uses the chronology of the instant to obtain the value. For example:
DateTime dt = new DateTime(); int year = dt.get(DateTimeFieldType.year());
type | a field type, usually obtained from DateTimeFieldType, not null |
---|
IllegalArgumentException | if the field type is null |
---|
Get the value of one of the fields of a datetime.
This could be used to get a field using a different Chronology. For example:
Instant dt = new Instant(); int gjYear = dt.get(Chronology.getCoptic().year());
field | the DateTimeField to use, not null |
---|
IllegalArgumentException | if the field is null |
---|
Gets the time zone of the instant from the chronology.
Gets a hash code for the instant as defined in ReadableInstant
.
Is this instant after the millisecond instant passed in comparing solely by millisecond.
instant | a millisecond instant to check against |
---|
Is this instant after the instant passed in comparing solely by millisecond.
instant | an instant to check against, null means now |
---|
Is this instant after the current instant comparing solely by millisecond.
Is this instant before the millisecond instant passed in comparing solely by millisecond.
instant | a millisecond instant to check against |
---|
Is this instant before the instant passed in comparing solely by millisecond.
instant | an instant to check against, null means now |
---|
Is this instant before the current instant comparing solely by millisecond.
Is this instant equal to the instant passed in comparing solely by millisecond.
instant | an instant to check against, null means now |
---|
Is this instant equal to the millisecond instant passed in comparing solely by millisecond.
instant | a millisecond instant to check against |
---|
Is this instant equal to the current instant comparing solely by millisecond.
Checks if the field type specified is supported by this instant and chronology.
This can be used to avoid exceptions in get(DateTimeFieldType)
.
type | a field type, usually obtained from DateTimeFieldType |
---|
Get the date time as a java.util.Date
.
The Date
object created has exactly the same millisecond
instant as this object.
Get this object as a DateTime using the given chronology and its zone.
chronology | chronology to apply, or ISOChronology if null |
---|
Get this object as a DateTime using the same chronology but a different zone.
zone | time zone to apply, or default if null |
---|
Get this object as a DateTime in the same zone.
Get this object as a DateTime using ISOChronology in the same zone.
Get this object as a MutableDateTime in the same zone.
Get this object as a MutableDateTime using the given chronology and its zone.
chronology | chronology to apply, or ISOChronology if null |
---|
Get this object as a MutableDateTime using the same chronology but a different zone.
zone | time zone to apply, or default if null |
---|
Get this object as a MutableDateTime using ISOChronology in the same zone.
Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZZ).
Uses the specified formatter to convert this partial to a String.
formatter | the formatter to use, null means use toString() . |
---|