public void testToMutableDateTimeISO() { DateTime test = new DateTime(TEST_TIME1, PARIS); MutableDateTime result = test.toMutableDateTimeISO(); assertSame(MutableDateTime.class, result.getClass()); assertSame(ISOChronology.class, result.getChronology().getClass()); assertEquals(test.getMillis(), result.getMillis()); assertEquals(ISO_PARIS, result.getChronology()); }
public void testToMutableDateTime_Chronology() { DateTime test = new DateTime(TEST_TIME1); MutableDateTime result = test.toMutableDateTime(ISO_DEFAULT); assertEquals(test.getMillis(), result.getMillis()); assertEquals(ISO_DEFAULT, result.getChronology()); test = new DateTime(TEST_TIME1); result = test.toMutableDateTime(GREGORIAN_PARIS); assertEquals(test.getMillis(), result.getMillis()); assertEquals(GREGORIAN_PARIS, result.getChronology()); test = new DateTime(TEST_TIME1, GREGORIAN_PARIS); result = test.toMutableDateTime((Chronology) null); assertEquals(test.getMillis(), result.getMillis()); assertEquals(ISO_DEFAULT, result.getChronology()); test = new DateTime(TEST_TIME1); result = test.toMutableDateTime((Chronology) null); assertEquals(test.getMillis(), result.getMillis()); assertEquals(ISO_DEFAULT, result.getChronology()); }
public void testToMutableDateTime_DateTimeZone() { DateTime test = new DateTime(TEST_TIME1); MutableDateTime result = test.toMutableDateTime(LONDON); assertEquals(test.getMillis(), result.getMillis()); assertEquals(ISO_DEFAULT, result.getChronology()); test = new DateTime(TEST_TIME1); result = test.toMutableDateTime(PARIS); assertEquals(test.getMillis(), result.getMillis()); assertEquals(ISO_PARIS, result.getChronology()); test = new DateTime(TEST_TIME1, PARIS); result = test.toMutableDateTime((DateTimeZone) null); assertEquals(test.getMillis(), result.getMillis()); assertEquals(ISO_DEFAULT, result.getChronology()); test = new DateTime(TEST_TIME1); result = test.toMutableDateTime((DateTimeZone) null); assertEquals(test.getMillis(), result.getMillis()); assertEquals(ISO_DEFAULT, result.getChronology()); }
/** * Round to the highest whole unit of this field. * * @return the mutable datetime being used, so calls can be chained * @see DateTimeField#roundCeiling */ public MutableDateTime roundCeiling() { iInstant.setMillis(getField().roundCeiling(iInstant.getMillis())); return iInstant; }
/** * 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. * * @return the mutable datetime being used, so calls can be chained * @see DateTimeField#roundHalfEven */ public MutableDateTime roundHalfEven() { iInstant.setMillis(getField().roundHalfEven(iInstant.getMillis())); return iInstant; }
/** * Sets a text value. * * @param text the text value to set * @param locale optional locale to use for selecting a text symbol * @return the mutable datetime being used, so calls can be chained * @throws IllegalArgumentException if the text value isn't valid */ public MutableDateTime set(String text, LocaleInfo locale) { iInstant.setMillis(getField().set(iInstant.getMillis(), text, locale)); return iInstant; }
/** * Sets a value. * * @param value the value to set. * @return the mutable datetime being used, so calls can be chained * @see DateTimeField#set(long,int) */ public MutableDateTime set(int value) { iInstant.setMillis(getField().set(iInstant.getMillis(), value)); return iInstant; }
/** * Adds a value to the millis value. * * @param value the value to add * @return the mutable datetime being used, so calls can be chained * @see DateTimeField#add(long,long) */ public MutableDateTime add(long value) { iInstant.setMillis(getField().add(iInstant.getMillis(), value)); return iInstant; }
/** * Gets the chronology of the datetime that this property is linked to. * * @return the chronology * @since 1.4 */ protected Chronology getChronology() { return iInstant.getChronology(); }
/** * Gets the milliseconds of the datetime that this property is linked to. * * @return the milliseconds */ protected long getMillis() { return iInstant.getMillis(); }