public class MutableDateTime extends BaseDateTime implements ReadWritableDateTime, java.lang.Cloneable, java.io.Serializable
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 compatible with the modern Gregorian calendar.
Each individual field can be accessed in two ways:
getHourOfDay()
hourOfDay().get()
MutableDateTime is mutable and not thread-safe, unless concurrent threads are not invoking mutator methods.
DateTime
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
MutableDateTime.Property
MutableDateTime.Property binds a MutableDateTime to a
DateTimeField allowing powerful datetime functionality to be easily
accessed.
|
Modifier and Type | Field and Description |
---|---|
static int |
ROUND_CEILING
Rounding mode as described by
DateTimeField.roundCeiling(long) |
static int |
ROUND_FLOOR
Rounding mode as described by
DateTimeField.roundFloor(long) |
static int |
ROUND_HALF_CEILING
Rounding mode as described by
DateTimeField.roundHalfCeiling(long) |
static int |
ROUND_HALF_EVEN
Rounding mode as described by
DateTimeField.roundHalfEven(long) |
static int |
ROUND_HALF_FLOOR
Rounding mode as described by
DateTimeField.roundHalfFloor(long) |
static int |
ROUND_NONE
Rounding is disabled
|
Constructor and Description |
---|
MutableDateTime()
Constructs an instance set to the current system millisecond time
using
ISOChronology in the default time zone. |
MutableDateTime(Chronology chronology)
Constructs an instance set to the current system millisecond time
using the specified chronology.
|
MutableDateTime(DateTimeZone zone)
Constructs an instance set to the current system millisecond time
using
ISOChronology in the specified time zone. |
MutableDateTime(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour,
int secondOfMinute,
int millisOfSecond)
Constructs an instance from datetime field values
using
ISOChronology in the default time zone. |
MutableDateTime(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour,
int secondOfMinute,
int millisOfSecond,
Chronology chronology)
Constructs an instance from datetime field values
using the specified chronology.
|
MutableDateTime(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour,
int secondOfMinute,
int millisOfSecond,
DateTimeZone zone)
Constructs an instance from datetime field values
using
ISOChronology in the specified time zone. |
MutableDateTime(long instant)
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z
using
ISOChronology in the default time zone. |
MutableDateTime(long instant,
Chronology chronology)
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z
using the specified chronology.
|
MutableDateTime(long instant,
DateTimeZone zone)
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z
using
ISOChronology in the specified time zone. |
MutableDateTime(java.lang.Object instant)
Constructs an instance from an Object that represents a datetime.
|
MutableDateTime(java.lang.Object instant,
Chronology chronology)
Constructs an instance from an Object that represents a datetime,
using the specified chronology.
|
MutableDateTime(java.lang.Object instant,
DateTimeZone zone)
Constructs an instance from an Object that represents a datetime,
forcing the time zone to that specified.
|
Modifier and Type | Method and Description |
---|---|
void |
add(DurationFieldType type,
int amount)
Adds to the instant specifying the duration and multiple to add.
|
void |
add(long duration)
Add an amount of time to the datetime.
|
void |
add(ReadableDuration duration)
Adds a duration to this instant.
|
void |
add(ReadableDuration duration,
int scalar)
Adds a duration to this instant specifying how many times to add.
|
void |
add(ReadablePeriod period)
Adds a period to this instant.
|
void |
add(ReadablePeriod period,
int scalar)
Adds a period to this instant specifying how many times to add.
|
void |
addDays(int days)
Add a number of days to the date.
|
void |
addHours(int hours)
Add a number of hours to the date.
|
void |
addMillis(int millis)
Add a number of milliseconds to the date.
|
void |
addMinutes(int minutes)
Add a number of minutes to the date.
|
void |
addMonths(int months)
Add a number of months to the date.
|
void |
addSeconds(int seconds)
Add a number of seconds to the date.
|
void |
addWeeks(int weeks)
Add a number of weeks to the date.
|
void |
addWeekyears(int weekyears)
Add a number of weekyears to the date.
|
void |
addYears(int years)
Add a number of years to the date.
|
MutableDateTime.Property |
centuryOfEra()
Get the century of era property.
|
java.lang.Object |
clone()
Clone this object.
|
MutableDateTime |
copy()
Clone this object without having to cast the returned object.
|
MutableDateTime.Property |
dayOfMonth()
Get the day of month property.
|
MutableDateTime.Property |
dayOfWeek()
Get the day of week property.
|
MutableDateTime.Property |
dayOfYear()
Get the day of year property.
|
MutableDateTime.Property |
era()
Get the era property.
|
DateTimeField |
getRoundingField()
Gets the field used for rounding this instant, returning null if rounding
is not enabled.
|
int |
getRoundingMode()
Gets the rounding mode for this instant, returning ROUND_NONE if rounding
is not enabled.
|
MutableDateTime.Property |
hourOfDay()
Get the hour of day field property
|
MutableDateTime.Property |
millisOfDay()
Get the millis of day property
|
MutableDateTime.Property |
millisOfSecond()
Get the millis of second property
|
MutableDateTime.Property |
minuteOfDay()
Get the minute of day property
|
MutableDateTime.Property |
minuteOfHour()
Get the minute of hour field property
|
MutableDateTime.Property |
monthOfYear()
Get the month of year property.
|
static MutableDateTime |
now()
Obtains a
MutableDateTime set to the current system millisecond time
using ISOChronology in the default time zone. |
static MutableDateTime |
now(Chronology chronology)
Obtains a
MutableDateTime set to the current system millisecond time
using the specified chronology. |
static MutableDateTime |
now(DateTimeZone zone)
Obtains a
MutableDateTime set to the current system millisecond time
using ISOChronology in the specified time zone. |
static MutableDateTime |
parse(java.lang.String str)
Parses a
MutableDateTime from the specified string. |
static MutableDateTime |
parse(java.lang.String str,
DateTimeFormatter formatter)
Parses a
MutableDateTime from the specified string using a formatter. |
MutableDateTime.Property |
property(DateTimeFieldType type)
Gets the property object for the specified type, which contains many useful methods.
|
MutableDateTime.Property |
secondOfDay()
Get the second of day property
|
MutableDateTime.Property |
secondOfMinute()
Get the second of minute field property
|
void |
set(DateTimeFieldType type,
int value)
Sets the value of one of the fields of the instant, such as hourOfDay.
|
void |
setChronology(Chronology chronology)
Set the chronology of the datetime.
|
void |
setDate(int year,
int monthOfYear,
int dayOfMonth)
Set the date from fields.
|
void |
setDate(long instant)
Set the date from milliseconds.
|
void |
setDate(ReadableInstant instant)
Set the date from another instant.
|
void |
setDateTime(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour,
int secondOfMinute,
int millisOfSecond)
Set the date and time from fields.
|
void |
setDayOfMonth(int dayOfMonth)
Set the day of the month to the specified value.
|
void |
setDayOfWeek(int dayOfWeek)
Set the day of week to the specified value.
|
void |
setDayOfYear(int dayOfYear)
Set the day of year to the specified value.
|
void |
setHourOfDay(int hourOfDay)
Set the hour of the day to the specified value.
|
void |
setMillis(long instant)
Set the milliseconds of the datetime.
|
void |
setMillis(ReadableInstant instant)
Sets the millisecond instant of this instant from another.
|
void |
setMillisOfDay(int millisOfDay)
Set the millis of the day to the specified value.
|
void |
setMillisOfSecond(int millisOfSecond)
Set the millis of the second to the specified value.
|
void |
setMinuteOfDay(int minuteOfDay)
Set the minute of the day to the specified value.
|
void |
setMinuteOfHour(int minuteOfHour)
Set the minute of the hour to the specified value.
|
void |
setMonthOfYear(int monthOfYear)
Set the month of the year to the specified value.
|
void |
setRounding(DateTimeField field)
Sets the status of rounding to use the specified field and ROUND_FLOOR mode.
|
void |
setRounding(DateTimeField field,
int mode)
Sets the status of rounding to use the specified field and mode.
|
void |
setSecondOfDay(int secondOfDay)
Set the second of the day to the specified value.
|
void |
setSecondOfMinute(int secondOfMinute)
Set the second of the minute to the specified value.
|
void |
setTime(int hour,
int minuteOfHour,
int secondOfMinute,
int millisOfSecond)
Set the time from fields.
|
void |
setTime(long millis)
Set the time from milliseconds.
|
void |
setTime(ReadableInstant instant)
Set the time from another instant.
|
void |
setWeekOfWeekyear(int weekOfWeekyear)
Set the week of weekyear to the specified value.
|
void |
setWeekyear(int weekyear)
Set the weekyear to the specified value.
|
void |
setYear(int year)
Set the year to the specified value.
|
void |
setZone(DateTimeZone newZone)
Sets the time zone of the datetime, changing the chronology and field values.
|
void |
setZoneRetainFields(DateTimeZone newZone)
Sets the time zone of the datetime, changing the chronology and millisecond.
|
MutableDateTime.Property |
weekOfWeekyear()
Get the week of a week based year property.
|
MutableDateTime.Property |
weekyear()
Get the year of a week based year property.
|
MutableDateTime.Property |
year()
Get the year property.
|
MutableDateTime.Property |
yearOfCentury()
Get the year of century property.
|
MutableDateTime.Property |
yearOfEra()
Get the year of era property.
|
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 static final int ROUND_NONE
public static final int ROUND_FLOOR
DateTimeField.roundFloor(long)
public static final int ROUND_CEILING
DateTimeField.roundCeiling(long)
public static final int ROUND_HALF_FLOOR
DateTimeField.roundHalfFloor(long)
public static final int ROUND_HALF_CEILING
DateTimeField.roundHalfCeiling(long)
public static final int ROUND_HALF_EVEN
DateTimeField.roundHalfEven(long)
public MutableDateTime()
ISOChronology
in the default time zone.now()
public MutableDateTime(DateTimeZone zone)
ISOChronology
in the specified time zone.
If the specified time zone is null, the default zone is used.
zone
- the time zone, null means default zonenow(DateTimeZone)
public MutableDateTime(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 MutableDateTime(long instant)
ISOChronology
in the default time zone.instant
- the milliseconds from 1970-01-01T00:00:00Zpublic MutableDateTime(long instant, DateTimeZone zone)
ISOChronology
in the specified time zone.
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 MutableDateTime(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 MutableDateTime(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.
instant
- the datetime object, null means nowjava.lang.IllegalArgumentException
- if the instant is invalidpublic MutableDateTime(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.
instant
- the datetime object, null means nowzone
- the time zone, null means default time zonejava.lang.IllegalArgumentException
- if the instant is invalidpublic MutableDateTime(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.
instant
- the datetime object, null means nowchronology
- the chronology, null means ISOChronology in default zonejava.lang.IllegalArgumentException
- if the instant is invalidpublic MutableDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
ISOChronology
in the default time zone.year
- the yearmonthOfYear
- the month of the yeardayOfMonth
- the day of the monthhourOfDay
- the hour of the dayminuteOfHour
- the minute of the hoursecondOfMinute
- the second of the minutemillisOfSecond
- the millisecond of the secondpublic MutableDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, DateTimeZone zone)
ISOChronology
in the specified time zone.
If the specified time zone is null, the default zone is used.
year
- the yearmonthOfYear
- the month of the yeardayOfMonth
- the day of the monthhourOfDay
- the hour of the dayminuteOfHour
- the minute of the hoursecondOfMinute
- the second of the minutemillisOfSecond
- the millisecond of the secondzone
- the time zone, null means default time zonepublic MutableDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, Chronology chronology)
If the chronology is null, ISOChronology
in the default time zone is used.
year
- the yearmonthOfYear
- the month of the yeardayOfMonth
- the day of the monthhourOfDay
- the hour of the dayminuteOfHour
- the minute of the hoursecondOfMinute
- the second of the minutemillisOfSecond
- the millisecond of the secondchronology
- the chronology, null means ISOChronology in default zonepublic static MutableDateTime now()
MutableDateTime
set to the current system millisecond time
using ISOChronology
in the default time zone.public static MutableDateTime now(DateTimeZone zone)
MutableDateTime
set to the current system millisecond time
using ISOChronology
in the specified time zone.zone
- the time zone, not nullpublic static MutableDateTime now(Chronology chronology)
MutableDateTime
set to the current system millisecond time
using the specified chronology.chronology
- the chronology, not nullpublic static MutableDateTime parse(java.lang.String str)
MutableDateTime
from the specified string.
This uses ISODateTimeFormat.dateTimeParser()
.
str
- the string to parse, not nullpublic static MutableDateTime parse(java.lang.String str, DateTimeFormatter formatter)
MutableDateTime
from the specified string using a formatter.str
- the string to parse, not nullformatter
- the formatter to use, not nullpublic DateTimeField getRoundingField()
public int getRoundingMode()
public void setRounding(DateTimeField field)
Enabling rounding will cause all subsequent calls to setMillis(long)
to be rounded. This can be used to control the precision of the instant,
for example by setting a rounding field of minuteOfDay, the seconds and
milliseconds will always be zero.
field
- rounding field or null to disablepublic void setRounding(DateTimeField field, int mode)
Enabling rounding will cause all subsequent calls to setMillis(long)
to be rounded. This can be used to control the precision of the instant,
for example by setting a rounding field of minuteOfDay, the seconds and
milliseconds will always be zero.
field
- rounding field or null to disablemode
- rounding mode or ROUND_NONE to disablejava.lang.IllegalArgumentException
- if mode is unknown, no exception if field is nullpublic void setMillis(long instant)
All changes to the millisecond field occurs via this method.
setMillis
in interface ReadWritableInstant
instant
- the milliseconds since 1970-01-01T00:00:00Z to set the
datetime topublic void setMillis(ReadableInstant instant)
This method does not change the chronology of this instant, just the millisecond instant.
setMillis
in interface ReadWritableInstant
instant
- the instant to use, null means nowpublic void add(long duration)
add
in interface ReadWritableInstant
duration
- the millis to addjava.lang.ArithmeticException
- if the result exceeds the capacity of the instantpublic void add(ReadableDuration duration)
This will typically change the value of most fields.
add
in interface ReadWritableInstant
duration
- the duration to add, null means add zerojava.lang.ArithmeticException
- if the result exceeds the capacity of the instantpublic void add(ReadableDuration duration, int scalar)
This will typically change the value of most fields.
add
in interface ReadWritableInstant
duration
- the duration to add, null means add zeroscalar
- direction and amount to add, which may be negativejava.lang.ArithmeticException
- if the result exceeds the capacity of the instantpublic void add(ReadablePeriod period)
This will typically change the value of most fields.
add
in interface ReadWritableInstant
period
- the period to add, null means add zerojava.lang.ArithmeticException
- if the result exceeds the capacity of the instantpublic void add(ReadablePeriod period, int scalar)
This will typically change the value of most fields.
add
in interface ReadWritableInstant
period
- the period to add, null means add zeroscalar
- direction and amount to add, which may be negativejava.lang.ArithmeticException
- if the result exceeds the capacity of the instantpublic void setChronology(Chronology chronology)
All changes to the chronology occur via this method.
setChronology
in interface ReadWritableInstant
chronology
- the chronology to use, null means ISOChronology in default zonepublic void setZone(DateTimeZone newZone)
Changing the zone using this method retains the millisecond instant. The millisecond instant is adjusted in the new zone to compensate. chronology. Setting the time zone does not affect the millisecond value of this instant.
If the chronology already has this time zone, no change occurs.
setZone
in interface ReadWritableInstant
newZone
- the time zone to use, null means default zonesetZoneRetainFields(org.joda.time.DateTimeZone)
public void setZoneRetainFields(DateTimeZone newZone)
Changing the zone using this method retains the field values. The millisecond instant is adjusted in the new zone to compensate.
If the chronology already has this time zone, no change occurs.
setZoneRetainFields
in interface ReadWritableInstant
newZone
- the time zone to use, null means default zonesetZone(org.joda.time.DateTimeZone)
public void set(DateTimeFieldType type, int value)
set
in interface ReadWritableInstant
type
- a field type, usually obtained from DateTimeFieldType, not nullvalue
- the value to set the field tojava.lang.IllegalArgumentException
- if the value is null or invalidpublic void add(DurationFieldType type, int amount)
add
in interface ReadWritableInstant
type
- a field type, usually obtained from DateTimeFieldType, not nullamount
- the amount to add of this durationjava.lang.IllegalArgumentException
- if the value is null or invalidjava.lang.ArithmeticException
- if the result exceeds the capacity of the instantpublic void setYear(int year)
setYear
in interface ReadWritableDateTime
year
- the yearjava.lang.IllegalArgumentException
- if the value is invalidpublic void addYears(int years)
addYears
in interface ReadWritableDateTime
years
- the years to addjava.lang.IllegalArgumentException
- if the value is invalidpublic void setWeekyear(int weekyear)
setWeekyear
in interface ReadWritableDateTime
weekyear
- the weekyearjava.lang.IllegalArgumentException
- if the value is invalidpublic void addWeekyears(int weekyears)
addWeekyears
in interface ReadWritableDateTime
weekyears
- the weekyears to addjava.lang.IllegalArgumentException
- if the value is invalidpublic void setMonthOfYear(int monthOfYear)
setMonthOfYear
in interface ReadWritableDateTime
monthOfYear
- the month of the yearjava.lang.IllegalArgumentException
- if the value is invalidpublic void addMonths(int months)
addMonths
in interface ReadWritableDateTime
months
- the months to addjava.lang.IllegalArgumentException
- if the value is invalidpublic void setWeekOfWeekyear(int weekOfWeekyear)
setWeekOfWeekyear
in interface ReadWritableDateTime
weekOfWeekyear
- the week of the weekyearjava.lang.IllegalArgumentException
- if the value is invalidpublic void addWeeks(int weeks)
addWeeks
in interface ReadWritableDateTime
weeks
- the weeks to addjava.lang.IllegalArgumentException
- if the value is invalidpublic void setDayOfYear(int dayOfYear)
setDayOfYear
in interface ReadWritableDateTime
dayOfYear
- the day of the yearjava.lang.IllegalArgumentException
- if the value is invalidpublic void setDayOfMonth(int dayOfMonth)
setDayOfMonth
in interface ReadWritableDateTime
dayOfMonth
- the day of the monthjava.lang.IllegalArgumentException
- if the value is invalidpublic void setDayOfWeek(int dayOfWeek)
setDayOfWeek
in interface ReadWritableDateTime
dayOfWeek
- the day of the weekjava.lang.IllegalArgumentException
- if the value is invalidpublic void addDays(int days)
addDays
in interface ReadWritableDateTime
days
- the days to addjava.lang.IllegalArgumentException
- if the value is invalidpublic void setHourOfDay(int hourOfDay)
setHourOfDay
in interface ReadWritableDateTime
hourOfDay
- the hour of dayjava.lang.IllegalArgumentException
- if the value is invalidpublic void addHours(int hours)
addHours
in interface ReadWritableDateTime
hours
- the hours to addjava.lang.IllegalArgumentException
- if the value is invalidpublic void setMinuteOfDay(int minuteOfDay)
setMinuteOfDay
in interface ReadWritableDateTime
minuteOfDay
- the minute of dayjava.lang.IllegalArgumentException
- if the value is invalidpublic void setMinuteOfHour(int minuteOfHour)
setMinuteOfHour
in interface ReadWritableDateTime
minuteOfHour
- the minute of hourjava.lang.IllegalArgumentException
- if the value is invalidpublic void addMinutes(int minutes)
addMinutes
in interface ReadWritableDateTime
minutes
- the minutes to addjava.lang.IllegalArgumentException
- if the value is invalidpublic void setSecondOfDay(int secondOfDay)
setSecondOfDay
in interface ReadWritableDateTime
secondOfDay
- the second of dayjava.lang.IllegalArgumentException
- if the value is invalidpublic void setSecondOfMinute(int secondOfMinute)
setSecondOfMinute
in interface ReadWritableDateTime
secondOfMinute
- the second of minutejava.lang.IllegalArgumentException
- if the value is invalidpublic void addSeconds(int seconds)
addSeconds
in interface ReadWritableDateTime
seconds
- the seconds to addjava.lang.IllegalArgumentException
- if the value is invalidpublic void setMillisOfDay(int millisOfDay)
setMillisOfDay
in interface ReadWritableDateTime
millisOfDay
- the millis of dayjava.lang.IllegalArgumentException
- if the value is invalidpublic void setMillisOfSecond(int millisOfSecond)
setMillisOfSecond
in interface ReadWritableDateTime
millisOfSecond
- the millis of secondjava.lang.IllegalArgumentException
- if the value is invalidpublic void addMillis(int millis)
add(long)
method in that a
DateTimeField performs the addition.addMillis
in interface ReadWritableDateTime
millis
- the milliseconds to addjava.lang.IllegalArgumentException
- if the value is invalidpublic void setDate(long instant)
instant
- an instant to copy the date from, time part ignoredjava.lang.IllegalArgumentException
- if the value is invalidpublic void setDate(ReadableInstant instant)
If the input is a ReadableDateTime
then it is converted to the
same time-zone as this object before using the instant millis.
instant
- an instant to copy the date from, time part ignoredjava.lang.IllegalArgumentException
- if the object is invalidpublic void setDate(int year, int monthOfYear, int dayOfMonth)
setDate
in interface ReadWritableDateTime
year
- the yearmonthOfYear
- the month of the yeardayOfMonth
- the day of the monthjava.lang.IllegalArgumentException
- if the value is invalidpublic void setTime(long millis)
millis
- an instant to copy the time from, date part ignoredjava.lang.IllegalArgumentException
- if the value is invalidpublic void setTime(ReadableInstant instant)
instant
- an instant to copy the time from, date part ignoredjava.lang.IllegalArgumentException
- if the object is invalidpublic void setTime(int hour, int minuteOfHour, int secondOfMinute, int millisOfSecond)
setTime
in interface ReadWritableDateTime
hour
- the hourminuteOfHour
- the minute of the hoursecondOfMinute
- the second of the minutemillisOfSecond
- the millisecond of the secondjava.lang.IllegalArgumentException
- if the value is invalidpublic void setDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
setDateTime
in interface ReadWritableDateTime
year
- the yearmonthOfYear
- the month of the yeardayOfMonth
- the day of the monthhourOfDay
- the hour of the dayminuteOfHour
- the minute of the hoursecondOfMinute
- the second of the minutemillisOfSecond
- the millisecond of the secondjava.lang.IllegalArgumentException
- if the value is invalidpublic MutableDateTime.Property property(DateTimeFieldType type)
type
- the field type to get the chronology forjava.lang.IllegalArgumentException
- if the field is null or unsupportedpublic MutableDateTime.Property era()
public MutableDateTime.Property centuryOfEra()
public MutableDateTime.Property yearOfCentury()
public MutableDateTime.Property yearOfEra()
public MutableDateTime.Property year()
public MutableDateTime.Property weekyear()
public MutableDateTime.Property monthOfYear()
public MutableDateTime.Property weekOfWeekyear()
public MutableDateTime.Property dayOfYear()
public MutableDateTime.Property dayOfMonth()
The values for day of month are defined in DateTimeConstants
.
public MutableDateTime.Property dayOfWeek()
The values for day of week are defined in DateTimeConstants
.
public MutableDateTime.Property hourOfDay()
public MutableDateTime.Property minuteOfDay()
public MutableDateTime.Property minuteOfHour()
public MutableDateTime.Property secondOfDay()
public MutableDateTime.Property secondOfMinute()
public MutableDateTime.Property millisOfDay()
public MutableDateTime.Property millisOfSecond()
public MutableDateTime copy()
public java.lang.Object clone()
clone
in class java.lang.Object
Copyright © 2010 - 2020 Adobe. All Rights Reserved