|
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.AbstractDateTime
|
+--org.joda.time.DateTime
DateTime is the basic implementation of a datetime class supporting chronologies and time zones. It holds the time as milliseconds from the Java epoch of 1970-01-01T00:00:00Z.
Each individual field can be queried in two ways:
getHourOfDay()
hourOfDay().get()
This class is immutable provided that the Chronology is immutable. All Chronology classes supplied are immutable.
| Constructor Summary | |
DateTime()
Constructs a DateTime to the current datetime, as reported by the system clock. |
|
DateTime(java.util.Calendar calendar)
Constructs a DateTime from a Calendar, using its closest mapped chronology and time zone. |
|
DateTime(java.util.Calendar calendar,
Chronology chronology)
Constructs a DateTime from a Calendar, using the supplied chronology. |
|
DateTime(java.util.Calendar calendar,
DateTimeZone zone)
Constructs a DateTime from a Calendar, using its closest mapped chronology against a different time zone. |
|
DateTime(Chronology chronology)
Constructs a DateTime to the current datetime, as reported by the system clock. |
|
DateTime(java.util.Date date)
Constructs a DateTime from a Date, using the ISO chronology, in the default time zone. |
|
DateTime(java.util.Date date,
Chronology chronology)
Constructs a DateTime from a Date, using the supplied chronology. |
|
DateTime(java.util.Date date,
DateTimeZone zone)
Constructs a DateTime from a Date, using the ISO chronology, in the supplied time zone. |
|
DateTime(DateTimeZone zone)
Constructs a DateTime to the current datetime, as reported by the system clock. |
|
DateTime(long millis)
Constructs a DateTime set to the milliseconds from 1970-01-01T00:00:00Z, using the ISO chronology, in the default time zone. |
|
DateTime(long millis,
Chronology chronology)
Constructs a DateTime set to the milliseconds from 1970-01-01T00:00:00Z, using the supplied chronology. |
|
DateTime(long millis,
DateTimeZone zone)
Constructs a DateTime set to the milliseconds from 1970-01-01T00:00:00Z, using the ISO chronology, in the supplied time zone. |
|
DateTime(ReadableInstant instant)
Constructs a DateTime from a ReadableInstant, using its chronology. |
|
DateTime(ReadableInstant instant,
Chronology chronology)
Constructs a DateTime from a ReadableInstant, using the supplied chronology. |
|
DateTime(ReadableInstant instant,
DateTimeZone zone)
Constructs a DateTime from a ReadableInstant, using its chronology against a different time zone. |
|
DateTime(java.lang.String str)
Constructs a DateTime from an ISO formatted String, using the ISO chronology, in the default time zone. |
|
DateTime(java.lang.String str,
Chronology chronology)
Constructs a DateTime from an ISO formatted String, using the supplied chronology. |
|
DateTime(java.lang.String str,
DateTimeZone zone)
Constructs a DateTime from an ISO formatted String, using the ISO chronology, in the supplied time zone. |
|
| Method Summary | |
DateTimeFieldProperty |
centuryOfEra()
Get the century of era property. |
protected ReadableInstant |
create(long millis,
Chronology chrono)
Creates a new instance of this class. |
DateTimeFieldProperty |
dayOfMonth()
Get the day of month property. |
DateTimeFieldProperty |
dayOfWeek()
Get the day of week property. |
DateTimeFieldProperty |
dayOfYear()
Get the day of year property. |
DateTimeFieldProperty |
era()
Get the era property. |
Chronology |
getChronology()
Gets the chronology of the datetime. |
long |
getMillis()
Gets the milliseconds of the datetime instant from the Java epoch of 1970-01-01T00:00:00Z. |
DateTimeFieldProperty |
hourOfDay()
Get the hour of day field property. |
DateTimeFieldProperty |
millisOfDay()
Get the millis of day property. |
DateTimeFieldProperty |
millisOfSecond()
Get the millis of second property. |
DateTimeFieldProperty |
minuteOfDay()
Get the minute of day property. |
DateTimeFieldProperty |
minuteOfHour()
Get the minute of hour field property. |
DateTimeFieldProperty |
monthOfYear()
Get the month of year property. |
DateTimeFieldProperty |
secondOfDay()
Get the second of day property. |
DateTimeFieldProperty |
secondOfMinute()
Get the second of minute field property. |
java.lang.String |
toString()
Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZ). |
DateTimeFieldProperty |
weekOfWeekyear()
Get the week of a week based year property. |
DateTimeFieldProperty |
weekyear()
Get the year of a week based year property. |
DateTimeFieldProperty |
year()
Get the year property. |
DateTimeFieldProperty |
yearOfCentury()
Get the year of century property. |
DateTimeFieldProperty |
yearOfEra()
Get the year of era property. |
| 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.ReadableDateTime |
getCenturyOfEra, getDayOfMonth, getDayOfWeek, getDayOfYear, getEra, getHourOfDay, getMillisOfDay, getMillisOfSecond, getMinuteOfDay, getMinuteOfHour, getMonthOfYear, getSecondOfDay, getSecondOfMinute, getWeekOfWeekyear, getWeekyear, getYear, getYearOfCentury, getYearOfEra, toDateTime, toDateTime, toDateTime, toMutableDateTime, toMutableDateTime, toMutableDateTime, toString, toString |
| Methods inherited from interface org.joda.time.ReadableInstant |
compareTo, equals, get, getDateTimeZone, hashCode, isAfter, isBefore, isEqual, toCopy, toCopy, toInstant |
| Constructor Detail |
public DateTime()
default time zone.
public DateTime(DateTimeZone zone)
zone - the time zone, must not be null
java.lang.IllegalArgumentException - if the zone is nullpublic DateTime(Chronology chronology)
chronology - the chronology, must not be null
java.lang.IllegalArgumentException - if the chronology is nullpublic DateTime(long millis)
default time zone.
millis - the milliseconds
public DateTime(long millis,
DateTimeZone zone)
millis - the millisecondszone - the time zone, must not be null
java.lang.IllegalArgumentException - if the zone is null
public DateTime(long millis,
Chronology chronology)
millis - the millisecondschronology - the chronology, must not be null
java.lang.IllegalArgumentException - if the chronology is nullpublic DateTime(ReadableInstant instant)
default time zone.
instant - the ReadableInstant, must not be null
java.lang.IllegalArgumentException - if the instant is null
public DateTime(ReadableInstant instant,
DateTimeZone zone)
instant - the ReadableInstant, must not be nullzone - the time zone, must not be null
java.lang.IllegalArgumentException - if the instant or zone is null
public DateTime(ReadableInstant instant,
Chronology chronology)
instant - the ReadableInstant, must not be nullchronology - the chronology, must not be null
java.lang.IllegalArgumentException - if the instant or chronology is nullpublic DateTime(java.util.Date date)
default time zone.
date - the Date, must not be null
java.lang.IllegalArgumentException - if the date is null
public DateTime(java.util.Date date,
DateTimeZone zone)
date - the Date, must not be nullzone - the time zone, must not be null
java.lang.IllegalArgumentException - if the date or zone is null
public DateTime(java.util.Date date,
Chronology chronology)
date - the Date, must not be nullchronology - the chronology, must not be null
java.lang.IllegalArgumentException - if the date or chronology is nullpublic DateTime(java.util.Calendar calendar)
When converting calendars to chronologies, the constructor is aware of GregorianCalendar and BuddhistCalendar and maps them to the equivalent chronology. Other calendars map to ISOChronology.
calendar - the Calendar, must not be null
java.lang.IllegalArgumentException - if the calendar is null
public DateTime(java.util.Calendar calendar,
DateTimeZone zone)
When converting calendars to chronologies, the constructor is aware of GregorianCalendar and BuddhistCalendar and maps them to the equivalent chronology. Other calendars map to ISOChronology.
calendar - the Calendar, must not be null
java.lang.IllegalArgumentException - if the calendar or zone is null
public DateTime(java.util.Calendar calendar,
Chronology chronology)
calendar - the Calendar, must not be nullchronology - the chronology, must not be null
java.lang.IllegalArgumentException - if the calendar or chronology is null
public DateTime(java.lang.String str)
throws java.text.ParseException
default time zone.
str - the string to parse, must not be null
java.lang.IllegalArgumentException - if the string is null
java.text.ParseException - if parsing fails
public DateTime(java.lang.String str,
DateTimeZone zone)
throws java.text.ParseException
str - the string to parse, must not be nullzone - the time zone, must not be null
java.lang.IllegalArgumentException - if the string or zone is null
java.text.ParseException - if parsing fails
public DateTime(java.lang.String str,
Chronology chronology)
throws java.text.ParseException
str - the string to parse, must not be nullchronology - the chronology, must not be null
java.lang.IllegalArgumentException - if the string or chronology is null
java.text.ParseException - if parsing fails| 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()
getChronology in interface ReadableInstantpublic final DateTimeFieldProperty dayOfWeek()
The values for day of week are defined in DateTimeConstants.
public final DateTimeFieldProperty dayOfMonth()
public final DateTimeFieldProperty dayOfYear()
public final DateTimeFieldProperty weekOfWeekyear()
public final DateTimeFieldProperty weekyear()
public final DateTimeFieldProperty monthOfYear()
public final DateTimeFieldProperty year()
public final DateTimeFieldProperty yearOfEra()
public final DateTimeFieldProperty yearOfCentury()
public final DateTimeFieldProperty centuryOfEra()
public final DateTimeFieldProperty era()
public final DateTimeFieldProperty millisOfSecond()
public final DateTimeFieldProperty millisOfDay()
public final DateTimeFieldProperty secondOfMinute()
public final DateTimeFieldProperty secondOfDay()
public final DateTimeFieldProperty minuteOfHour()
public final DateTimeFieldProperty minuteOfDay()
public final DateTimeFieldProperty hourOfDay()
public final java.lang.String toString()
toString in interface ReadableInstanttoString in class AbstractDateTime
|
Joda Time API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||