Class DateTimeFieldType
- All Implemented Interfaces:
Serializable
A field type defines the type of the field, such as hourOfDay.
If does not directly enable any calculations, however it does provide a
getField(Chronology)
method that returns the actual calculation engine
for a particular chronology.
It also provides access to the related DurationFieldType
s.
Instances of DateTimeFieldType
are singletons.
They can be compared using ==
.
If required, you can create your own field, for example a quarterOfYear.
You must create a subclass of DateTimeFieldType
that defines the field type.
This class returns the actual calculation engine from getField(Chronology)
.
The subclass should implement equals and hashCode.
- Since:
- 1.0
- Author:
- Stephen Colebourne, Brian S O'Neill
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DateTimeFieldType
Get the century of era field type.static DateTimeFieldType
Get the hour of day (offset to 1-24) field type.static DateTimeFieldType
Get the hour of am/pm (offset to 1-12) field type.static DateTimeFieldType
Get the day of month field type.static DateTimeFieldType
Get the day of week field type.static DateTimeFieldType
Get the day of year field type.static DateTimeFieldType
era()
Get the era field type.abstract DurationFieldType
Get the duration unit of the field.abstract DateTimeField
getField
(Chronology chronology) Gets a suitable field for this type from the given Chronology.getName()
Get the name of the field.abstract DurationFieldType
Get the duration range of the field.static DateTimeFieldType
Get the AM(0) PM(1) field type.static DateTimeFieldType
Get the hour of day (0-23) field type.static DateTimeFieldType
Get the hour of am/pm (0-11) field type.boolean
isSupported
(Chronology chronology) Checks whether this field supported in the given Chronology.static DateTimeFieldType
Get the millis of day field type.static DateTimeFieldType
Get the millis of second field type.static DateTimeFieldType
Get the minute of day field type.static DateTimeFieldType
Get the minute of hour field type.static DateTimeFieldType
Get the month of year field type.static DateTimeFieldType
Get the second of day field type.static DateTimeFieldType
Get the second of minute field type.toString()
Get a suitable debug string.static DateTimeFieldType
Get the week of a week based year field type.static DateTimeFieldType
weekyear()
Get the year of a week based year field type.static DateTimeFieldType
Get the year of a week based year within a century field type.static DateTimeFieldType
year()
Get the year field type.static DateTimeFieldType
Get the year of century field type.static DateTimeFieldType
Get the year of era field type.
-
Constructor Details
-
DateTimeFieldType
Constructor.- Parameters:
name
- the name to use
-
-
Method Details
-
millisOfSecond
Get the millis of second field type.- Returns:
- the DateTimeFieldType constant
-
millisOfDay
Get the millis of day field type.This measures the milliseconds from the start of the day on the local time-line. On a daylight saving date, this means that some values will be missed (in spring) or duplicated (in autumn/fall).
- Returns:
- the DateTimeFieldType constant
-
secondOfMinute
Get the second of minute field type.- Returns:
- the DateTimeFieldType constant
-
secondOfDay
Get the second of day field type.This measures the seconds from the start of the day on the local time-line. On a daylight saving date, this means that some values will be missed (in spring) or duplicated (in autumn/fall).
- Returns:
- the DateTimeFieldType constant
-
minuteOfHour
Get the minute of hour field type.- Returns:
- the DateTimeFieldType constant
-
minuteOfDay
Get the minute of day field type.This measures the minutes from the start of the day on the local time-line. On a daylight saving date, this means that some values will be missed (in spring) or duplicated (in autumn/fall).
- Returns:
- the DateTimeFieldType constant
-
hourOfDay
Get the hour of day (0-23) field type.- Returns:
- the DateTimeFieldType constant
-
clockhourOfDay
Get the hour of day (offset to 1-24) field type.- Returns:
- the DateTimeFieldType constant
-
hourOfHalfday
Get the hour of am/pm (0-11) field type.- Returns:
- the DateTimeFieldType constant
-
clockhourOfHalfday
Get the hour of am/pm (offset to 1-12) field type.- Returns:
- the DateTimeFieldType constant
-
halfdayOfDay
Get the AM(0) PM(1) field type.- Returns:
- the DateTimeFieldType constant
-
dayOfWeek
Get the day of week field type.- Returns:
- the DateTimeFieldType constant
-
dayOfMonth
Get the day of month field type.- Returns:
- the DateTimeFieldType constant
-
dayOfYear
Get the day of year field type.- Returns:
- the DateTimeFieldType constant
-
weekOfWeekyear
Get the week of a week based year field type.- Returns:
- the DateTimeFieldType constant
-
weekyear
Get the year of a week based year field type.- Returns:
- the DateTimeFieldType constant
-
weekyearOfCentury
Get the year of a week based year within a century field type.- Returns:
- the DateTimeFieldType constant
-
monthOfYear
Get the month of year field type.- Returns:
- the DateTimeFieldType constant
-
year
Get the year field type.- Returns:
- the DateTimeFieldType constant
-
yearOfEra
Get the year of era field type.- Returns:
- the DateTimeFieldType constant
-
yearOfCentury
Get the year of century field type.- Returns:
- the DateTimeFieldType constant
-
centuryOfEra
Get the century of era field type.- Returns:
- the DateTimeFieldType constant
-
era
Get the era field type.- Returns:
- the DateTimeFieldType constant
-
getName
Get the name of the field.By convention, names follow a pattern of "dddOfRrr", where "ddd" represents the (singular) duration unit field name and "Rrr" represents the (singular) duration range field name. If the range field is not applicable, then the name of the field is simply the (singular) duration field name.
- Returns:
- field name
-
getDurationType
Get the duration unit of the field.- Returns:
- duration unit of the field, never null
-
getRangeDurationType
Get the duration range of the field.- Returns:
- duration range of the field, null if unbounded
-
getField
Gets a suitable field for this type from the given Chronology.- Parameters:
chronology
- the chronology to use, null means ISOChronology in default zone- Returns:
- a suitable field
-
isSupported
Checks whether this field supported in the given Chronology.- Parameters:
chronology
- the chronology to use, null means ISOChronology in default zone- Returns:
- true if supported
-
toString
Get a suitable debug string.
-