Interface ReadableDateTime
- All Superinterfaces:
Comparable<ReadableInstant>
,ReadableInstant
- All Known Subinterfaces:
ReadWritableDateTime
- All Known Implementing Classes:
AbstractDateTime
,BaseDateTime
,DateMidnight
,DateTime
,MutableDateTime
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 ReadableDateTime
as a parameter if the method only wants to read the datetime, and not perform
any advanced manipulations.
- Since:
- 1.0
- Author:
- Stephen Colebourne, Brian S O'Neill
-
Method Summary
Modifier and TypeMethodDescriptionint
Get the year of era field value.int
Get the day of month field value.int
Get the day of week field value.int
Get the day of year field value.int
getEra()
Get the era field value.int
Get the hour of day field value.int
Get the millis of day field value.int
Get the millis of second field value.int
Get the minute of day field value.int
Get the minute of hour field value.int
Get the month of year field value.int
Get the second of day field value.int
Get the second of minute field value.int
Get the week of weekyear field value.int
Get the weekyear field value.int
getYear()
Get the year field value.int
Get the year of century field value.int
Get the year of era field value.Get this object as a DateTime.Get this object as a MutableDateTime, always returning a new instance.Output the instant using the specified format pattern.Output the instant using the specified format pattern.Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface org.joda.time.ReadableInstant
equals, get, getChronology, getMillis, getZone, hashCode, isAfter, isBefore, isEqual, isSupported, toInstant, toString
-
Method Details
-
getDayOfWeek
int getDayOfWeek()Get the day of week field value.The values for the day of week are defined in
DateTimeConstants
.- Returns:
- the day of week
-
getDayOfMonth
int getDayOfMonth()Get the day of month field value.- Returns:
- the day of month
-
getDayOfYear
int getDayOfYear()Get the day of year field value.- Returns:
- the day of year
-
getWeekOfWeekyear
int getWeekOfWeekyear()Get the week of weekyear field value.This field is associated with the "weekyear" via
getWeekyear()
. In the standard ISO8601 week algorithm, the first week of the year is that in which at least 4 days are in the year. As a result of this definition, day 1 of the first week may be in the previous year.- Returns:
- the week of a week based year
-
getWeekyear
int getWeekyear()Get the weekyear field value.The weekyear is the year that matches with the weekOfWeekyear field. In the standard ISO8601 week algorithm, the first week of the year is that in which at least 4 days are in the year. As a result of this definition, day 1 of the first week may be in the previous year. The weekyear allows you to query the effective year for that day.
- Returns:
- the year of a week based year
-
getMonthOfYear
int getMonthOfYear()Get the month of year field value.- Returns:
- the month of year
-
getYear
int getYear()Get the year field value.- Returns:
- the year
-
getYearOfEra
int getYearOfEra()Get the year of era field value.- Returns:
- the year of era
-
getYearOfCentury
int getYearOfCentury()Get the year of century field value.- Returns:
- the year of century
-
getCenturyOfEra
int getCenturyOfEra()Get the year of era field value.- Returns:
- the year of era
-
getEra
int getEra()Get the era field value.- Returns:
- the era
-
getMillisOfSecond
int getMillisOfSecond()Get the millis of second field value.- Returns:
- the millis of second
-
getMillisOfDay
int getMillisOfDay()Get the millis of day field value.- Returns:
- the millis of day
-
getSecondOfMinute
int getSecondOfMinute()Get the second of minute field value.- Returns:
- the second of minute
-
getSecondOfDay
int getSecondOfDay()Get the second of day field value.- Returns:
- the second of day
-
getMinuteOfHour
int getMinuteOfHour()Get the minute of hour field value.- Returns:
- the minute of hour
-
getMinuteOfDay
int getMinuteOfDay()Get the minute of day field value.- Returns:
- the minute of day
-
getHourOfDay
int getHourOfDay()Get the hour of day field value.- Returns:
- the hour of day
-
toDateTime
DateTime toDateTime()Get this object as a DateTime.If the implementation of the interface is a DateTime, it is returned directly.
- Returns:
- a DateTime using the same millis
-
toMutableDateTime
MutableDateTime toMutableDateTime()Get this object as a MutableDateTime, always returning a new instance.- Returns:
- a MutableDateTime using the same millis
-
toString
Output the instant using the specified format pattern.- Parameters:
pattern
- pattern specification- Throws:
IllegalArgumentException
- if pattern is invalid- See Also:
-
toString
Output the instant using the specified format pattern.- Parameters:
pattern
- pattern specificationlocale
- Locale to use, or null for default- Throws:
IllegalArgumentException
- if pattern is invalid- See Also:
-