DateMidnight defines a date where the time component is fixed at midnight. The class uses a time zone, thus midnight is local unless a UTC time zone is used.
It is important to emphasise that this class represents the time of midnight on any given day. Note that midnight is defined as 00:00, which is at the very start of a day.
This class does not represent a day, but the millisecond instant at midnight. If you need a class that represents the whole day, then an {@link Interval} ora {@link LocalDate} may be more suitable.
This class uses a Chronology internally. The Chronology determines how the millisecond instant value is converted into the date time fields. The default Chronology is ISOChronology
which is the agreed international standard and compatable with the modern Gregorian calendar.
Each individual field can be queried in two ways:
getDayOfMonth()
dayOfMonth().get()
The second technique also provides access to other useful methods on the field:
- numeric value
- text value
- short text value
- maximum/minimum values
- add/subtract
- set
- rounding
DateMidnight is thread-safe and immutable, provided that the Chronology is as well. All standard Chronology classes supplied are thread-safe and immutable.
@author Stephen Colebourne
@since 1.0