public static final class

MutableDateTime.Property

extends AbstractReadableInstantFieldProperty
java.lang.Object
   ↳ org.joda.time.field.AbstractReadableInstantFieldProperty
     ↳ org.joda.time.MutableDateTime.Property

Class Overview

MutableDateTime.Property binds a MutableDateTime to a DateTimeField allowing powerful datetime functionality to be easily accessed.

The example below shows how to use the property to change the value of a MutableDateTime object.

 MutableDateTime dt = new MutableDateTime(1972, 12, 3, 13, 32, 19, 123);
 dt.year().add(20);
 dt.second().roundFloor().minute().set(10);
 

MutableDateTime.Propery itself is thread-safe and immutable, but the MutableDateTime being operated on is not.

Summary

Public Methods
MutableDateTime add(long value)
Adds a value to the millis value.
MutableDateTime add(int value)
Adds a value to the millis value.
MutableDateTime addWrapField(int value)
Adds a value, possibly wrapped, to the millis value.
DateTimeField getField()
Gets the field being used.
MutableDateTime getMutableDateTime()
Gets the mutable datetime being used.
MutableDateTime roundCeiling()
Round to the highest whole unit of this field.
MutableDateTime roundFloor()
Round to the lowest whole unit of this field.
MutableDateTime roundHalfCeiling()
Round to the nearest whole unit of this field, favoring the ceiling if halfway.
MutableDateTime roundHalfEven()
Round to the nearest whole unit of this field.
MutableDateTime roundHalfFloor()
Round to the nearest whole unit of this field, favoring the floor if halfway.
MutableDateTime set(String text, Locale locale)
Sets a text value.
MutableDateTime set(String text)
Sets a text value.
MutableDateTime set(int value)
Sets a value.
Protected Methods
Chronology getChronology()
Gets the chronology of the datetime that this property is linked to.
long getMillis()
Gets the milliseconds of the datetime that this property is linked to.
[Expand]
Inherited Methods
From class org.joda.time.field.AbstractReadableInstantFieldProperty
From class java.lang.Object

Public Methods

public MutableDateTime add (long value)

Adds a value to the millis value.

Parameters
value the value to add
Returns
  • the mutable datetime being used, so calls can be chained
See Also

public MutableDateTime add (int value)

Adds a value to the millis value.

Parameters
value the value to add
Returns
  • the mutable datetime being used, so calls can be chained
See Also

public MutableDateTime addWrapField (int value)

Adds a value, possibly wrapped, to the millis value.

Parameters
value the value to add
Returns
  • the mutable datetime being used, so calls can be chained

public DateTimeField getField ()

Gets the field being used.

Returns
  • the field

public MutableDateTime getMutableDateTime ()

Gets the mutable datetime being used.

Returns
  • the mutable datetime

public MutableDateTime roundCeiling ()

Round to the highest whole unit of this field.

Returns
  • the mutable datetime being used, so calls can be chained

public MutableDateTime roundFloor ()

Round to the lowest whole unit of this field.

Returns
  • the mutable datetime being used, so calls can be chained
See Also

public MutableDateTime roundHalfCeiling ()

Round to the nearest whole unit of this field, favoring the ceiling if halfway.

Returns
  • the mutable datetime being used, so calls can be chained

public MutableDateTime roundHalfEven ()

Round to the nearest whole unit of this field. If halfway, the ceiling is favored over the floor only if it makes this field's value even.

Returns
  • the mutable datetime being used, so calls can be chained

public MutableDateTime roundHalfFloor ()

Round to the nearest whole unit of this field, favoring the floor if halfway.

Returns
  • the mutable datetime being used, so calls can be chained

public MutableDateTime set (String text, Locale locale)

Sets a text value.

Parameters
text the text value to set
locale optional locale to use for selecting a text symbol
Returns
  • the mutable datetime being used, so calls can be chained
Throws
IllegalArgumentException if the text value isn't valid

public MutableDateTime set (String text)

Sets a text value.

Parameters
text the text value to set
Returns
  • the mutable datetime being used, so calls can be chained
Throws
IllegalArgumentException if the text value isn't valid

public MutableDateTime set (int value)

Sets a value.

Parameters
value the value to set.
Returns
  • the mutable datetime being used, so calls can be chained
See Also

Protected Methods

protected Chronology getChronology ()

Gets the chronology of the datetime that this property is linked to.

Returns
  • the chronology

protected long getMillis ()

Gets the milliseconds of the datetime that this property is linked to.

Returns
  • the milliseconds