|
Joda Time API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.joda.time.AbstractInstant
|
+--org.joda.time.Instant
Instant is the standard implementation of a fully immutable instant in time. It holds the instant as milliseconds from the Java Epoch of 1970-01-01T00:00:00Z.
There is no concept of a calendar system, chronology or time zone. In a fully internationalized program, methods should accept the ReadableInstant interface as input and return Instant objects.
| Constructor Summary | |
Instant()
Constructor that sets the time to be the current time from the system clock. |
|
Instant(java.util.Calendar calendar)
Constructor that takes a Calendar. |
|
Instant(java.util.Date date)
Constructor that takes a Date. |
|
Instant(long millis)
Constructor that takes milliseconds from 1970-01-01T00:00:00Z. |
|
Instant(ReadableInstant instant)
Constructor that takes a ReadableInstant. |
|
Instant(java.lang.String str)
Constructor that parses an ISO formatted string. |
|
| Method Summary | |
protected ReadableInstant |
create(long millis,
Chronology chrono)
Creates a new instance of this class. |
Chronology |
getChronology()
Gets the chronology of the instant, which is null. |
long |
getMillis()
Gets the milliseconds of the instant. |
java.lang.String |
toString()
Output the date time in ISO8601 format. |
| Methods inherited from class org.joda.time.AbstractInstant |
compareTo, equals, get, getDateTimeZone, hashCode, isAfter, isBefore, isEqual, toCalendar, toCopy, toCopy, toDate, toGregorianCalendar, toInstant |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.joda.time.ReadableInstant |
compareTo, equals, get, getDateTimeZone, hashCode, isAfter, isBefore, isEqual, toCopy, toCopy, toInstant |
| Constructor Detail |
public Instant()
public Instant(long millis)
millis - the millisecondspublic Instant(ReadableInstant instant)
instant - the ReadableInstant
java.lang.IllegalArgumentException - if the instant is nullpublic Instant(java.util.Date date)
date - the Date
java.lang.IllegalArgumentException - if the date is nullpublic Instant(java.util.Calendar calendar)
calendar - the Calendar
java.lang.IllegalArgumentException - if the calendar is null
public Instant(java.lang.String str)
throws java.text.ParseException
str - the string
java.lang.IllegalArgumentException - if the string is null
java.text.ParseException - if the string is incorrectly formatted| Method Detail |
protected ReadableInstant create(long millis,
Chronology chrono)
The returned object will be a new instance of the implementation.
Immutable subclasses may return this if appropriate.
create in class AbstractInstantmillis - the new millis, from 1970-01-01T00:00:00Zchrono - the new chronology
java.lang.IllegalArgumentException - if the chronology is nullpublic final long getMillis()
getMillis in interface ReadableInstantpublic final Chronology getChronology()
The Chronology provides conversion from the millisecond
value to meaningful fields in a particular calendar system. This
class represents a chronology free view of time, so this method
returns null.
getChronology in interface ReadableInstantpublic final java.lang.String toString()
ISO8601 is deliberately used here so that the resulting string can be re-parsed by the constructor.
toString in interface ReadableInstanttoString in class AbstractInstant
|
Joda Time API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||