LocalDate
to represent a date without a time zone.
Or use DateTime
to represent a full date and time, perhaps
using DateTime.withTimeAtStartOfDay()
to get an instant at the
start of a day.@Deprecated public final class DateMidnight extends BaseDateTime implements ReadableDateTime, java.io.Serializable
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 Interval
or
a 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()
DateMidnight is thread-safe and immutable, provided that the Chronology is as well. All standard Chronology classes supplied are thread-safe and immutable.
Modifier and Type | Class and Description |
---|---|
static class |
DateMidnight.Property
Deprecated.
DateMidnight.Property binds a DateMidnight to a DateTimeField allowing powerful
datetime functionality to be easily accessed.
|
Constructor and Description |
---|
DateMidnight()
Deprecated.
Constructs an instance set to the current system millisecond time
using
ISOChronology in the default time zone. |
DateMidnight(Chronology chronology)
Deprecated.
Constructs an instance set to the current system millisecond time
using the specified chronology.
|
DateMidnight(DateTimeZone zone)
Deprecated.
Constructs an instance set to the current system millisecond time
using
ISOChronology in the specified time zone. |
DateMidnight(int year,
int monthOfYear,
int dayOfMonth)
Deprecated.
Constructs an instance from datetime field values
using
ISOChronology in the default time zone. |
DateMidnight(int year,
int monthOfYear,
int dayOfMonth,
Chronology chronology)
Deprecated.
Constructs an instance from datetime field values
using the specified chronology.
|
DateMidnight(int year,
int monthOfYear,
int dayOfMonth,
DateTimeZone zone)
Deprecated.
Constructs an instance from datetime field values
using
ISOChronology in the specified time zone. |
DateMidnight(long instant)
Deprecated.
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z
using
ISOChronology in the default time zone. |
DateMidnight(long instant,
Chronology chronology)
Deprecated.
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z
using the specified chronology.
|
DateMidnight(long instant,
DateTimeZone zone)
Deprecated.
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z
using
ISOChronology in the specified time zone. |
DateMidnight(java.lang.Object instant)
Deprecated.
Constructs an instance from an Object that represents a datetime.
|
DateMidnight(java.lang.Object instant,
Chronology chronology)
Deprecated.
Constructs an instance from an Object that represents a datetime,
using the specified chronology.
|
DateMidnight(java.lang.Object instant,
DateTimeZone zone)
Deprecated.
Constructs an instance from an Object that represents a datetime,
forcing the time zone to that specified.
|
Modifier and Type | Method and Description |
---|---|
DateMidnight.Property |
centuryOfEra()
Deprecated.
Get the century of era property which provides access to advanced functionality.
|
DateMidnight.Property |
dayOfMonth()
Deprecated.
Get the day of month property which provides access to advanced functionality.
|
DateMidnight.Property |
dayOfWeek()
Deprecated.
Get the day of week property which provides access to advanced functionality.
|
DateMidnight.Property |
dayOfYear()
Deprecated.
Get the day of year property which provides access to advanced functionality.
|
DateMidnight.Property |
era()
Deprecated.
Get the era property which provides access to advanced functionality.
|
DateMidnight |
minus(long duration)
Deprecated.
Returns a copy of this date with the specified duration taken away.
|
DateMidnight |
minus(ReadableDuration duration)
Deprecated.
Returns a copy of this date with the specified duration taken away.
|
DateMidnight |
minus(ReadablePeriod period)
Deprecated.
Returns a copy of this date with the specified period taken away.
|
DateMidnight |
minusDays(int days)
Deprecated.
Returns a copy of this date minus the specified number of days.
|
DateMidnight |
minusMonths(int months)
Deprecated.
Returns a copy of this date minus the specified number of months.
|
DateMidnight |
minusWeeks(int weeks)
Deprecated.
Returns a copy of this date minus the specified number of weeks.
|
DateMidnight |
minusYears(int years)
Deprecated.
Returns a copy of this date minus the specified number of years.
|
DateMidnight.Property |
monthOfYear()
Deprecated.
Get the month of year property which provides access to advanced functionality.
|
static DateMidnight |
now()
Deprecated.
Obtains a
DateMidnight set to the current system millisecond time
using ISOChronology in the default time zone. |
static DateMidnight |
now(Chronology chronology)
Deprecated.
Obtains a
DateMidnight set to the current system millisecond time
using the specified chronology. |
static DateMidnight |
now(DateTimeZone zone)
Deprecated.
Obtains a
DateMidnight set to the current system millisecond time
using ISOChronology in the specified time zone. |
static DateMidnight |
parse(java.lang.String str)
Deprecated.
Parses a
DateMidnight from the specified string. |
static DateMidnight |
parse(java.lang.String str,
DateTimeFormatter formatter)
Deprecated.
Parses a
DateMidnight from the specified string using a formatter. |
DateMidnight |
plus(long duration)
Deprecated.
Returns a copy of this date with the specified duration added.
|
DateMidnight |
plus(ReadableDuration duration)
Deprecated.
Returns a copy of this date with the specified duration added.
|
DateMidnight |
plus(ReadablePeriod period)
Deprecated.
Returns a copy of this date with the specified period added.
|
DateMidnight |
plusDays(int days)
Deprecated.
Returns a copy of this date plus the specified number of days.
|
DateMidnight |
plusMonths(int months)
Deprecated.
Returns a copy of this date plus the specified number of months.
|
DateMidnight |
plusWeeks(int weeks)
Deprecated.
Returns a copy of this date plus the specified number of weeks.
|
DateMidnight |
plusYears(int years)
Deprecated.
Returns a copy of this date plus the specified number of years.
|
DateMidnight.Property |
property(DateTimeFieldType type)
Deprecated.
Gets the property object for the specified type, which contains many useful methods.
|
Interval |
toInterval()
Deprecated.
Converts this object to an
Interval encompassing
the whole of this day. |
LocalDate |
toLocalDate()
Deprecated.
Converts this object to a
LocalDate with the
same date and chronology. |
YearMonthDay |
toYearMonthDay()
Deprecated.
Use LocalDate instead of YearMonthDay
|
DateMidnight.Property |
weekOfWeekyear()
Deprecated.
Get the week of a week based year property which provides access to advanced functionality.
|
DateMidnight.Property |
weekyear()
Deprecated.
Get the year of a week based year property which provides access to advanced functionality.
|
DateMidnight |
withCenturyOfEra(int centuryOfEra)
Deprecated.
Returns a copy of this date with the century of era field updated.
|
DateMidnight |
withChronology(Chronology newChronology)
Deprecated.
Returns a copy of this date with a different chronology, potentially
changing the day in unexpected ways.
|
DateMidnight |
withDayOfMonth(int dayOfMonth)
Deprecated.
Returns a copy of this date with the day of month field updated.
|
DateMidnight |
withDayOfWeek(int dayOfWeek)
Deprecated.
Returns a copy of this date with the day of week field updated.
|
DateMidnight |
withDayOfYear(int dayOfYear)
Deprecated.
Returns a copy of this date with the day of year field updated.
|
DateMidnight |
withDurationAdded(long durationToAdd,
int scalar)
Deprecated.
Returns a copy of this date with the specified duration added.
|
DateMidnight |
withDurationAdded(ReadableDuration durationToAdd,
int scalar)
Deprecated.
Returns a copy of this date with the specified duration added.
|
DateMidnight |
withEra(int era)
Deprecated.
Returns a copy of this date with the era field updated.
|
DateMidnight |
withField(DateTimeFieldType fieldType,
int value)
Deprecated.
Returns a copy of this date with the specified field set to a new value.
|
DateMidnight |
withFieldAdded(DurationFieldType fieldType,
int amount)
Deprecated.
Returns a copy of this date with the value of the specified field increased.
|
DateMidnight |
withFields(ReadablePartial partial)
Deprecated.
Returns a copy of this date with the partial set of fields replacing those
from this instance.
|
DateMidnight |
withMillis(long newMillis)
Deprecated.
Returns a copy of this date with a different millisecond instant.
|
DateMidnight |
withMonthOfYear(int monthOfYear)
Deprecated.
Returns a copy of this date with the month of year field updated.
|
DateMidnight |
withPeriodAdded(ReadablePeriod period,
int scalar)
Deprecated.
Returns a copy of this date with the specified period added.
|
DateMidnight |
withWeekOfWeekyear(int weekOfWeekyear)
Deprecated.
Returns a copy of this date with the week of weekyear field updated.
|
DateMidnight |
withWeekyear(int weekyear)
Deprecated.
Returns a copy of this date with the weekyear field updated.
|
DateMidnight |
withYear(int year)
Deprecated.
Returns a copy of this date with the year field updated.
|
DateMidnight |
withYearOfCentury(int yearOfCentury)
Deprecated.
Returns a copy of this date with the year of century field updated.
|
DateMidnight |
withYearOfEra(int yearOfEra)
Deprecated.
Returns a copy of this date with the year of era field updated.
|
DateMidnight |
withZoneRetainFields(DateTimeZone newZone)
Deprecated.
Returns a copy of this date with a different time zone, preserving the day
The returned object will have a local time of midnight in the new zone on
the same day as the original instant.
|
DateMidnight.Property |
year()
Deprecated.
Get the year property which provides access to advanced functionality.
|
DateMidnight.Property |
yearOfCentury()
Deprecated.
Get the year of century property which provides access to advanced functionality.
|
DateMidnight.Property |
yearOfEra()
Deprecated.
Get the year of era property which provides access to advanced functionality.
|
getChronology, getMillis
get, getCenturyOfEra, getDayOfMonth, getDayOfWeek, getDayOfYear, getEra, getHourOfDay, getMillisOfDay, getMillisOfSecond, getMinuteOfDay, getMinuteOfHour, getMonthOfYear, getSecondOfDay, getSecondOfMinute, getWeekOfWeekyear, getWeekyear, getYear, getYearOfCentury, getYearOfEra, toCalendar, toGregorianCalendar, toString, toString, toString
compareTo, equals, get, getZone, hashCode, isAfter, isAfter, isAfterNow, isBefore, isBefore, isBeforeNow, isEqual, isEqual, isEqualNow, isSupported, toDate, toDateTime, toDateTime, toDateTime, toDateTimeISO, toInstant, toMutableDateTime, toMutableDateTime, toMutableDateTime, toMutableDateTimeISO, toString
getCenturyOfEra, getDayOfMonth, getDayOfWeek, getDayOfYear, getEra, getHourOfDay, getMillisOfDay, getMillisOfSecond, getMinuteOfDay, getMinuteOfHour, getMonthOfYear, getSecondOfDay, getSecondOfMinute, getWeekOfWeekyear, getWeekyear, getYear, getYearOfCentury, getYearOfEra, toDateTime, toMutableDateTime, toString, toString
equals, get, getChronology, getMillis, getZone, hashCode, isAfter, isBefore, isEqual, isSupported, toInstant, toString
public DateMidnight()
ISOChronology
in the default time zone.
The constructed object will have a local time of midnight.now()
public DateMidnight(DateTimeZone zone)
ISOChronology
in the specified time zone.
The constructed object will have a local time of midnight.
If the specified time zone is null, the default zone is used.
zone
- the time zone, null means default zonenow(DateTimeZone)
public DateMidnight(Chronology chronology)
If the chronology is null, ISOChronology
in the default time zone is used.
chronology
- the chronology, null means ISOChronology in default zonenow(Chronology)
public DateMidnight(long instant)
ISOChronology
in the default time zone.
The constructed object will have a local time of midnight.instant
- the milliseconds from 1970-01-01T00:00:00Zpublic DateMidnight(long instant, DateTimeZone zone)
ISOChronology
in the specified time zone.
The constructed object will have a local time of midnight.
If the specified time zone is null, the default zone is used.
instant
- the milliseconds from 1970-01-01T00:00:00Zzone
- the time zone, null means default zonepublic DateMidnight(long instant, Chronology chronology)
If the chronology is null, ISOChronology
in the default time zone is used.
instant
- the milliseconds from 1970-01-01T00:00:00Zchronology
- the chronology, null means ISOChronology in default zonepublic DateMidnight(java.lang.Object instant)
If the object implies a chronology (such as GregorianCalendar does), then that chronology will be used. Otherwise, ISO default is used. Thus if a GregorianCalendar is passed in, the chronology used will be GJ, but if a Date is passed in the chronology will be ISO.
The recognised object types are defined in
ConverterManager
and
include ReadableInstant, String, Calendar and Date.
The String formats are described by ISODateTimeFormat.dateTimeParser()
.
instant
- the datetime object, null means nowjava.lang.IllegalArgumentException
- if the instant is invalidpublic DateMidnight(java.lang.Object instant, DateTimeZone zone)
If the object implies a chronology (such as GregorianCalendar does), then that chronology will be used, but with the time zone adjusted. Otherwise, ISO is used in the specified time zone. If the specified time zone is null, the default zone is used. Thus if a GregorianCalendar is passed in, the chronology used will be GJ, but if a Date is passed in the chronology will be ISO.
The recognised object types are defined in
ConverterManager
and
include ReadableInstant, String, Calendar and Date.
The String formats are described by ISODateTimeFormat.dateTimeParser()
.
instant
- the datetime object, null means nowzone
- the time zone, null means default time zonejava.lang.IllegalArgumentException
- if the instant is invalidpublic DateMidnight(java.lang.Object instant, Chronology chronology)
If the chronology is null, ISO in the default time zone is used. Any chronology implied by the object (such as GregorianCalendar does) is ignored.
The recognised object types are defined in
ConverterManager
and
include ReadableInstant, String, Calendar and Date.
The String formats are described by ISODateTimeFormat.dateTimeParser()
.
instant
- the datetime object, null means nowchronology
- the chronology, null means ISOChronology in default zonejava.lang.IllegalArgumentException
- if the instant is invalidpublic DateMidnight(int year, int monthOfYear, int dayOfMonth)
ISOChronology
in the default time zone.
The constructed object will have a local time of midnight.year
- the yearmonthOfYear
- the month of the year, from 1 to 12dayOfMonth
- the day of the month, from 1 to 31public DateMidnight(int year, int monthOfYear, int dayOfMonth, DateTimeZone zone)
ISOChronology
in the specified time zone.
The constructed object will have a local time of midnight.
If the specified time zone is null, the default zone is used.
year
- the yearmonthOfYear
- the month of the year, from 1 to 12dayOfMonth
- the day of the month, from 1 to 31zone
- the time zone, null means default time zonepublic DateMidnight(int year, int monthOfYear, int dayOfMonth, Chronology chronology)
If the chronology is null, ISOChronology
in the default time zone is used.
year
- the year, valid values defined by the chronologymonthOfYear
- the month of the year, valid values defined by the chronologydayOfMonth
- the day of the month, valid values defined by the chronologychronology
- the chronology, null means ISOChronology in default zonepublic static DateMidnight now()
DateMidnight
set to the current system millisecond time
using ISOChronology
in the default time zone.
The constructed object will have a local time of midnight.public static DateMidnight now(DateTimeZone zone)
DateMidnight
set to the current system millisecond time
using ISOChronology
in the specified time zone.
The constructed object will have a local time of midnight.zone
- the time zone, not nullpublic static DateMidnight now(Chronology chronology)
DateMidnight
set to the current system millisecond time
using the specified chronology.
The constructed object will have a local time of midnight.chronology
- the chronology, not nullpublic static DateMidnight parse(java.lang.String str)
DateMidnight
from the specified string.
This uses ISODateTimeFormat.dateTimeParser()
.
str
- the string to parse, not nullpublic static DateMidnight parse(java.lang.String str, DateTimeFormatter formatter)
DateMidnight
from the specified string using a formatter.str
- the string to parse, not nullformatter
- the formatter to use, not nullpublic DateMidnight withMillis(long newMillis)
Only the millis will change, the chronology and time zone are kept.
The returned object will be either be a new instance or this
.
newMillis
- the new millis, from 1970-01-01T00:00:00Zpublic DateMidnight withChronology(Chronology newChronology)
This method creates a new DateMidnight using the midnight millisecond value and the new chronology. If the same or similar chronology is specified, but with a different time zone, the day may change. This occurs because the new DateMidnight rounds down the millisecond value to get to midnight, and the time zone change may result in a rounding down to a different day.
For example, changing time zone from London (+00:00) to Paris (+01:00) will retain the same day, but changing from Paris to London will change the day. (When its midnight in London its the same day in Paris, but when its midnight in Paris its still the previous day in London)
To avoid these unusual effects, use withZoneRetainFields(DateTimeZone)
to change time zones.
newChronology
- the new chronologypublic DateMidnight withZoneRetainFields(DateTimeZone newZone)
newZone
- the new time zone, null means defaultpublic DateMidnight withFields(ReadablePartial partial)
For example, if the partial is a LocalDate
then the date fields
would be changed in the returned instance.
If the partial is null, then this
is returned.
partial
- the partial set of fields to apply to this datetime, null ignoredjava.lang.IllegalArgumentException
- if any value is invalidpublic DateMidnight withField(DateTimeFieldType fieldType, int value)
For example, if the field type is dayOfMonth
then the day of month
field would be changed in the returned instance.
If the field type is null, then this
is returned.
These three lines are equivalent:
DateTime updated = dt.withField(DateTimeFieldType.dayOfMonth(), 6); DateTime updated = dt.dayOfMonth().setCopy(6); DateTime updated = dt.property(DateTimeFieldType.dayOfMonth()).setCopy(6);
fieldType
- the field type to set, not nullvalue
- the value to setjava.lang.IllegalArgumentException
- if the value is null or invalidpublic DateMidnight withFieldAdded(DurationFieldType fieldType, int amount)
If the addition is zero or the field is null, then this
is returned.
These three lines are equivalent:
DateMidnight added = dt.withFieldAdded(DateTimeFieldType.year(), 6); DateMidnight added = dt.plusYears(6); DateMidnight added = dt.year().addToCopy(6);
fieldType
- the field type to add to, not nullamount
- the amount to addjava.lang.IllegalArgumentException
- if the value is null or invalidjava.lang.ArithmeticException
- if the new datetime exceeds the capacity of a longpublic DateMidnight withDurationAdded(long durationToAdd, int scalar)
If the addition is zero, then this
is returned.
durationToAdd
- the duration to add to this onescalar
- the amount of times to add, such as -1 to subtract oncejava.lang.ArithmeticException
- if the new datetime exceeds the capacity of a longpublic DateMidnight withDurationAdded(ReadableDuration durationToAdd, int scalar)
If the addition is zero, then this
is returned.
durationToAdd
- the duration to add to this one, null means zeroscalar
- the amount of times to add, such as -1 to subtract oncejava.lang.ArithmeticException
- if the new datetime exceeds the capacity of a longpublic DateMidnight withPeriodAdded(ReadablePeriod period, int scalar)
If the addition is zero, then this
is returned.
This method is typically used to add multiple copies of complex
period instances. Adding one field is best achieved using methods
like withFieldAdded(DurationFieldType, int)
or plusYears(int)
.
period
- the period to add to this one, null means zeroscalar
- the amount of times to add, such as -1 to subtract oncejava.lang.ArithmeticException
- if the new datetime exceeds the capacity of a longpublic DateMidnight plus(long duration)
If the amount is zero, then this
is returned.
duration
- the duration, in millis, to add to this onejava.lang.ArithmeticException
- if the new datetime exceeds the capacity of a longpublic DateMidnight plus(ReadableDuration duration)
If the amount is zero or null, then this
is returned.
duration
- the duration to add to this one, null means zerojava.lang.ArithmeticException
- if the new datetime exceeds the capacity of a longpublic DateMidnight plus(ReadablePeriod period)
If the amount is zero or null, then this
is returned.
This method is typically used to add complex period instances.
Adding one field is best achieved using methods
like plusYears(int)
.
period
- the duration to add to this one, null means zerojava.lang.ArithmeticException
- if the new datetime exceeds the capacity of a longpublic DateMidnight plusYears(int years)
This datetime instance is immutable and unaffected by this method call.
The following three lines are identical in effect:
DateMidnight added = dt.plusYears(6); DateMidnight added = dt.plus(Period.years(6)); DateMidnight added = dt.withFieldAdded(DurationFieldType.years(), 6);
years
- the amount of years to add, may be negativepublic DateMidnight plusMonths(int months)
This datetime instance is immutable and unaffected by this method call.
The following three lines are identical in effect:
DateMidnight added = dt.plusMonths(6); DateMidnight added = dt.plus(Period.months(6)); DateMidnight added = dt.withFieldAdded(DurationFieldType.months(), 6);
months
- the amount of months to add, may be negativepublic DateMidnight plusWeeks(int weeks)
This datetime instance is immutable and unaffected by this method call.
The following three lines are identical in effect:
DateMidnight added = dt.plusWeeks(6); DateMidnight added = dt.plus(Period.weeks(6)); DateMidnight added = dt.withFieldAdded(DurationFieldType.weeks(), 6);
weeks
- the amount of weeks to add, may be negativepublic DateMidnight plusDays(int days)
This datetime instance is immutable and unaffected by this method call.
The following three lines are identical in effect:
DateMidnight added = dt.plusDays(6); DateMidnight added = dt.plus(Period.days(6)); DateMidnight added = dt.withFieldAdded(DurationFieldType.days(), 6);
days
- the amount of days to add, may be negativepublic DateMidnight minus(long duration)
If the amount is zero or null, then this
is returned.
duration
- the duration, in millis, to reduce this instant byjava.lang.ArithmeticException
- if the new datetime exceeds the capacity of a longpublic DateMidnight minus(ReadableDuration duration)
If the amount is zero or null, then this
is returned.
duration
- the duration to reduce this instant byjava.lang.ArithmeticException
- if the new datetime exceeds the capacity of a longpublic DateMidnight minus(ReadablePeriod period)
If the amount is zero or null, then this
is returned.
This method is typically used to subtract complex period instances.
Subtracting one field is best achieved using methods
like minusYears(int)
.
period
- the period to reduce this instant byjava.lang.ArithmeticException
- if the new datetime exceeds the capacity of a longpublic DateMidnight minusYears(int years)
This datetime instance is immutable and unaffected by this method call.
The following three lines are identical in effect:
DateTime subtracted = dt.minusYears(6); DateTime subtracted = dt.minus(Period.years(6)); DateTime subtracted = dt.withFieldAdded(DurationFieldType.years(), -6);
years
- the amount of years to subtract, may be negativepublic DateMidnight minusMonths(int months)
This datetime instance is immutable and unaffected by this method call.
The following three lines are identical in effect:
DateMidnight subtracted = dt.minusMonths(6); DateMidnight subtracted = dt.minus(Period.months(6)); DateMidnight subtracted = dt.withFieldAdded(DurationFieldType.months(), -6);
months
- the amount of months to subtract, may be negativepublic DateMidnight minusWeeks(int weeks)
This datetime instance is immutable and unaffected by this method call.
The following three lines are identical in effect:
DateMidnight subtracted = dt.minusWeeks(6); DateMidnight subtracted = dt.minus(Period.weeks(6)); DateMidnight subtracted = dt.withFieldAdded(DurationFieldType.weeks(), -6);
weeks
- the amount of weeks to subtract, may be negativepublic DateMidnight minusDays(int days)
This datetime instance is immutable and unaffected by this method call.
The following three lines are identical in effect:
DateMidnight subtracted = dt.minusDays(6); DateMidnight subtracted = dt.minus(Period.days(6)); DateMidnight subtracted = dt.withFieldAdded(DurationFieldType.days(), -6);
days
- the amount of days to subtract, may be negativepublic DateMidnight.Property property(DateTimeFieldType type)
type
- the field type to get the chronology forjava.lang.IllegalArgumentException
- if the field is null or unsupported@Deprecated public YearMonthDay toYearMonthDay()
YearMonthDay
using the
same date and chronology.public LocalDate toLocalDate()
LocalDate
with the
same date and chronology.public Interval toInterval()
Interval
encompassing
the whole of this day.
The interval starts at midnight 00:00 and ends at 00:00 the following day, (which is not included in the interval, as intervals are half-open).
public DateMidnight withEra(int era)
DateMidnight is immutable, so there are no set methods. Instead, this method returns a new instance with the value of era changed.
era
- the era to setjava.lang.IllegalArgumentException
- if the value is invalidpublic DateMidnight withCenturyOfEra(int centuryOfEra)
DateMidnight is immutable, so there are no set methods. Instead, this method returns a new instance with the value of century of era changed.
centuryOfEra
- the centurey of era to setjava.lang.IllegalArgumentException
- if the value is invalidpublic DateMidnight withYearOfEra(int yearOfEra)
DateMidnight is immutable, so there are no set methods. Instead, this method returns a new instance with the value of year of era changed.
yearOfEra
- the year of era to setjava.lang.IllegalArgumentException
- if the value is invalidpublic DateMidnight withYearOfCentury(int yearOfCentury)
DateMidnight is immutable, so there are no set methods. Instead, this method returns a new instance with the value of year of century changed.
yearOfCentury
- the year of century to setjava.lang.IllegalArgumentException
- if the value is invalidpublic DateMidnight withYear(int year)
DateMidnight is immutable, so there are no set methods. Instead, this method returns a new instance with the value of year changed.
year
- the year to setjava.lang.IllegalArgumentException
- if the value is invalidpublic DateMidnight withWeekyear(int weekyear)
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.
DateMidnight is immutable, so there are no set methods. Instead, this method returns a new instance with the value of weekyear changed.
weekyear
- the weekyear to setjava.lang.IllegalArgumentException
- if the value is invalidpublic DateMidnight withMonthOfYear(int monthOfYear)
DateMidnight is immutable, so there are no set methods. Instead, this method returns a new instance with the value of month of year changed.
monthOfYear
- the month of year to setjava.lang.IllegalArgumentException
- if the value is invalidpublic DateMidnight withWeekOfWeekyear(int weekOfWeekyear)
This field is associated with the "weekyear" via withWeekyear(int)
.
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.
DateMidnight is immutable, so there are no set methods. Instead, this method returns a new instance with the value of week of weekyear changed.
weekOfWeekyear
- the week of weekyear to setjava.lang.IllegalArgumentException
- if the value is invalidpublic DateMidnight withDayOfYear(int dayOfYear)
DateMidnight is immutable, so there are no set methods. Instead, this method returns a new instance with the value of day of year changed.
dayOfYear
- the day of year to setjava.lang.IllegalArgumentException
- if the value is invalidpublic DateMidnight withDayOfMonth(int dayOfMonth)
DateMidnight is immutable, so there are no set methods. Instead, this method returns a new instance with the value of day of month changed.
dayOfMonth
- the day of month to setjava.lang.IllegalArgumentException
- if the value is invalidpublic DateMidnight withDayOfWeek(int dayOfWeek)
DateMidnight is immutable, so there are no set methods. Instead, this method returns a new instance with the value of day of week changed.
dayOfWeek
- the day of week to setjava.lang.IllegalArgumentException
- if the value is invalidpublic DateMidnight.Property era()
public DateMidnight.Property centuryOfEra()
public DateMidnight.Property yearOfCentury()
public DateMidnight.Property yearOfEra()
public DateMidnight.Property year()
public DateMidnight.Property weekyear()
public DateMidnight.Property monthOfYear()
public DateMidnight.Property weekOfWeekyear()
public DateMidnight.Property dayOfYear()
public DateMidnight.Property dayOfMonth()
public DateMidnight.Property dayOfWeek()
Copyright © 2010 - 2020 Adobe. All Rights Reserved