Joda Time API

org.joda.time
Class AbstractDateTime

java.lang.Object
  |
  +--org.joda.time.AbstractInstant
        |
        +--org.joda.time.AbstractDateTime
All Implemented Interfaces:
java.lang.Comparable, ReadableDateTime, ReadableInstant, java.io.Serializable
Direct Known Subclasses:
DateTime, MutableDateTime

public abstract class AbstractDateTime
extends AbstractInstant
implements ReadableDateTime

AbstractDateTime provides the common behaviour for immutable datetime classes.

This class should generally not be used directly by API users. The ReadableDateTime interface should be used when different kinds of date/time objects are to be referenced.

Since:
1.0
Author:
Brian S O'Neill
See Also:
Serialized Form

Constructor Summary
AbstractDateTime()
           
 
Method Summary
 int getCenturyOfEra()
          Get the year of era field value.
 int getDayOfMonth()
          Get the day of month field value.
 int getDayOfWeek()
          Get the day of week field value.
 int getDayOfYear()
          Get the day of year field value.
 int getEra()
          Get the era field value.
 int getHourOfDay()
          Get the hour of day field value.
 int getMillisOfDay()
          Get the millis of day field value.
 int getMillisOfSecond()
          Get the millis of second field value.
 int getMinuteOfDay()
          Get the minute of day field value.
 int getMinuteOfHour()
          Get the minute of hour field value.
 int getMonthOfYear()
          Get the month of year field value.
 int getSecondOfDay()
          Get the second of day field value.
 int getSecondOfMinute()
          Get the second of minute field value.
 int getWeekOfWeekyear()
          Get the week of weekyear field value.
 int getWeekyear()
          Get the weekyear field value.
 int getYear()
          Get the year field value.
 int getYearOfCentury()
          Get the year of century field value.
 int getYearOfEra()
          Get the year of era field value.
 DateTime toDateTime()
          Get this object as a DateTime.
 DateTime toDateTime(Chronology chronology)
          Get this object as a DateTime.
 DateTime toDateTime(DateTimeZone zone)
          Get this object as a DateTime.
 DateTime toISODateTime()
          Get this object as a trusted ISO DateTime.
 DateTime toISODateTime(DateTimeZone zone)
          Get this object as a trusted ISO DateTime.
 MutableDateTime toISOMutableDateTime()
          Get this object as a trusted ISO MutableDateTime.
 MutableDateTime toISOMutableDateTime(DateTimeZone zone)
          Get this object as a trusted ISO MutableDateTime.
 MutableDateTime toMutableDateTime()
          Get this object as a MutableDateTime.
 MutableDateTime toMutableDateTime(Chronology chronology)
          Get this object as a MutableDateTime.
 MutableDateTime toMutableDateTime(DateTimeZone zone)
          Get this object as a MutableDateTime.
 java.lang.String toString()
          Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZ).
 java.lang.String toString(java.lang.String pattern)
          Output the instant using the specified format pattern.
 java.lang.String toString(java.lang.String pattern, java.util.Locale locale)
          Output the instant using the specified format pattern.
 
Methods inherited from class org.joda.time.AbstractInstant
compareTo, create, 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, getChronology, getDateTimeZone, getMillis, hashCode, isAfter, isBefore, isEqual, toCopy, toCopy, toInstant
 

Constructor Detail

AbstractDateTime

public AbstractDateTime()
Method Detail

getDayOfWeek

public final int getDayOfWeek()
Get the day of week field value.

The values for the day of week are defined in DateTimeConstants.

Specified by:
getDayOfWeek in interface ReadableDateTime
Returns:
the day of week

getDayOfMonth

public final int getDayOfMonth()
Get the day of month field value.

Specified by:
getDayOfMonth in interface ReadableDateTime
Returns:
the day of month

getDayOfYear

public final int getDayOfYear()
Get the day of year field value.

Specified by:
getDayOfYear in interface ReadableDateTime
Returns:
the day of year

getWeekOfWeekyear

public final int getWeekOfWeekyear()
Get the week of weekyear field value.

Specified by:
getWeekOfWeekyear in interface ReadableDateTime
Returns:
the week of a week based year

getWeekyear

public final int getWeekyear()
Get the weekyear field value.

Specified by:
getWeekyear in interface ReadableDateTime
Returns:
the year of a week based year

getMonthOfYear

public final int getMonthOfYear()
Get the month of year field value.

Specified by:
getMonthOfYear in interface ReadableDateTime
Returns:
the month of year

getYear

public final int getYear()
Get the year field value.

Specified by:
getYear in interface ReadableDateTime
Returns:
the year

getYearOfEra

public final int getYearOfEra()
Get the year of era field value.

Specified by:
getYearOfEra in interface ReadableDateTime
Returns:
the year of era

getYearOfCentury

public final int getYearOfCentury()
Get the year of century field value.

Specified by:
getYearOfCentury in interface ReadableDateTime
Returns:
the year of century

getCenturyOfEra

public final int getCenturyOfEra()
Get the year of era field value.

Specified by:
getCenturyOfEra in interface ReadableDateTime
Returns:
the year of era

getEra

public final int getEra()
Get the era field value.

Specified by:
getEra in interface ReadableDateTime
Returns:
the era

getMillisOfSecond

public final int getMillisOfSecond()
Get the millis of second field value.

Specified by:
getMillisOfSecond in interface ReadableDateTime
Returns:
the millis of second

getMillisOfDay

public final int getMillisOfDay()
Get the millis of day field value.

Specified by:
getMillisOfDay in interface ReadableDateTime
Returns:
the millis of day

getSecondOfMinute

public final int getSecondOfMinute()
Get the second of minute field value.

Specified by:
getSecondOfMinute in interface ReadableDateTime
Returns:
the second of minute

getSecondOfDay

public final int getSecondOfDay()
Get the second of day field value.

Specified by:
getSecondOfDay in interface ReadableDateTime
Returns:
the second of day

getMinuteOfHour

public final int getMinuteOfHour()
Get the minute of hour field value.

Specified by:
getMinuteOfHour in interface ReadableDateTime
Returns:
the minute of hour

getMinuteOfDay

public final int getMinuteOfDay()
Get the minute of day field value.

Specified by:
getMinuteOfDay in interface ReadableDateTime
Returns:
the minute of day

getHourOfDay

public final int getHourOfDay()
Get the hour of day field value.

Specified by:
getHourOfDay in interface ReadableDateTime
Returns:
the hour of day

toDateTime

public final DateTime toDateTime()
Get this object as a DateTime.

Specified by:
toDateTime in interface ReadableDateTime
Returns:
a DateTime using the same millis

toDateTime

public final DateTime toDateTime(DateTimeZone zone)
Get this object as a DateTime.

Specified by:
toDateTime in interface ReadableDateTime
Parameters:
zone - time zone to apply
Returns:
a DateTime using the same millis
Throws:
java.lang.IllegalArgumentException - if the time zone is null

toDateTime

public final DateTime toDateTime(Chronology chronology)
Get this object as a DateTime.

Specified by:
toDateTime in interface ReadableDateTime
Parameters:
chronology - chronology to apply
Returns:
a DateTime using the same millis
Throws:
java.lang.IllegalArgumentException - if the chronology is null

toISODateTime

public final DateTime toISODateTime()
Get this object as a trusted ISO DateTime.

Returns:
an ISO DateTime using the same millis

toISODateTime

public final DateTime toISODateTime(DateTimeZone zone)
Get this object as a trusted ISO DateTime.

Parameters:
zone - time zone to apply
Returns:
an ISO DateTime using the same millis
Throws:
java.lang.IllegalArgumentException - if the time zone is null

toMutableDateTime

public final MutableDateTime toMutableDateTime()
Get this object as a MutableDateTime.

Specified by:
toMutableDateTime in interface ReadableDateTime
Returns:
a MutableDateTime using the same millis

toMutableDateTime

public final MutableDateTime toMutableDateTime(DateTimeZone zone)
Get this object as a MutableDateTime.

Specified by:
toMutableDateTime in interface ReadableDateTime
Parameters:
zone - time zone to apply
Returns:
a MutableDateTime using the same millis
Throws:
java.lang.IllegalArgumentException - if the time zone is null

toMutableDateTime

public final MutableDateTime toMutableDateTime(Chronology chronology)
Get this object as a MutableDateTime.

Specified by:
toMutableDateTime in interface ReadableDateTime
Parameters:
chronology - chronology to apply
Returns:
a MutableDateTime using the same millis
Throws:
java.lang.IllegalArgumentException - if the chronology is null

toISOMutableDateTime

public final MutableDateTime toISOMutableDateTime()
Get this object as a trusted ISO MutableDateTime.

Returns:
an ISO MutableDateTime using the same millis

toISOMutableDateTime

public final MutableDateTime toISOMutableDateTime(DateTimeZone zone)
Get this object as a trusted ISO MutableDateTime.

Parameters:
zone - time zone to apply
Returns:
an ISO MutableDateTime using the same millis
Throws:
java.lang.IllegalArgumentException - if the time zone is null

toString

public java.lang.String toString()
Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZ).

Specified by:
toString in interface ReadableInstant
Specified by:
toString in class AbstractInstant
Returns:
ISO8601 time formatted string.

toString

public java.lang.String toString(java.lang.String pattern)
                          throws java.lang.IllegalArgumentException
Output the instant using the specified format pattern.

Specified by:
toString in interface ReadableDateTime
Parameters:
pattern - the pattern specification
java.lang.IllegalArgumentException
See Also:
DateTimeFormatterBuilder.appendPattern(java.lang.String)

toString

public java.lang.String toString(java.lang.String pattern,
                                 java.util.Locale locale)
                          throws java.lang.IllegalArgumentException
Output the instant using the specified format pattern.

Specified by:
toString in interface ReadableDateTime
Parameters:
pattern - the pattern specification
locale - the Locale to use, must not be null
Throws:
java.lang.IllegalArgumentException - if the locale is null
See Also:
DateTimeFormatterBuilder.appendPattern(java.lang.String)

Joda Time API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.