use of org.joda.time.MutableDateTime in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseInto_chrono.
public void testParseInto_chrono() {
MutableDateTime expect = null;
MutableDateTime result = null;
expect = new MutableDateTime(2004, 6, 9, 12, 20, 30, 0, PARIS);
result = new MutableDateTime(0L);
assertEquals(20, g.withChronology(ISO_PARIS).parseInto(result, "2004-06-09T10:20:30Z", 0));
assertEquals(expect, result);
expect = new MutableDateTime(2004, 6, 9, 11, 20, 30, 0, LONDON);
result = new MutableDateTime(0L);
assertEquals(20, g.withChronology(null).parseInto(result, "2004-06-09T10:20:30Z", 0));
assertEquals(expect, result);
expect = new MutableDateTime(2547, 6, 9, 12, 20, 30, 0, BUDDHIST_PARIS);
result = new MutableDateTime(0L);
assertEquals(20, g.withChronology(BUDDHIST_PARIS).parseInto(result, "2547-06-09T10:20:30Z", 0));
assertEquals(expect, result);
expect = new MutableDateTime(2004, 6, 9, 10, 29, 51, 0, BUDDHIST_PARIS);
result = new MutableDateTime(0L);
assertEquals(20, g.withChronology(BUDDHIST_PARIS).parseInto(result, "2004-06-09T10:20:30Z", 0));
assertEquals(expect, result);
}
use of org.joda.time.MutableDateTime in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseInto_zone.
public void testParseInto_zone() {
MutableDateTime expect = null;
MutableDateTime result = null;
expect = new MutableDateTime(2004, 6, 9, 11, 20, 30, 0, LONDON);
result = new MutableDateTime(0L);
assertEquals(20, g.withZone(LONDON).parseInto(result, "2004-06-09T10:20:30Z", 0));
assertEquals(expect, result);
expect = new MutableDateTime(2004, 6, 9, 11, 20, 30, 0, LONDON);
result = new MutableDateTime(0L);
assertEquals(20, g.withZone(null).parseInto(result, "2004-06-09T10:20:30Z", 0));
assertEquals(expect, result);
expect = new MutableDateTime(2004, 6, 9, 12, 20, 30, 0, PARIS);
result = new MutableDateTime(0L);
assertEquals(20, g.withZone(PARIS).parseInto(result, "2004-06-09T10:20:30Z", 0));
assertEquals(expect, result);
}
use of org.joda.time.MutableDateTime in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseInto_zone2.
public void testParseInto_zone2() {
MutableDateTime expect = null;
MutableDateTime result = null;
expect = new MutableDateTime(2004, 6, 9, 11, 20, 30, 0, LONDON);
result = new MutableDateTime(0L);
assertEquals(25, g.withZone(LONDON).parseInto(result, "2004-06-09T06:20:30-04:00", 0));
assertEquals(expect, result);
expect = new MutableDateTime(2004, 6, 9, 11, 20, 30, 0, LONDON);
assertEquals(25, g.withZone(null).parseInto(result, "2004-06-09T06:20:30-04:00", 0));
assertEquals(expect, result);
expect = new MutableDateTime(2004, 6, 9, 12, 20, 30, 0, PARIS);
assertEquals(25, g.withZone(PARIS).parseInto(result, "2004-06-09T06:20:30-04:00", 0));
assertEquals(expect, result);
}
use of org.joda.time.MutableDateTime in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseInto_monthDay_feb29_newYork.
public void testParseInto_monthDay_feb29_newYork() {
DateTimeFormatter f = DateTimeFormat.forPattern("M d").withLocale(Locale.UK);
MutableDateTime result = new MutableDateTime(2004, 1, 9, 12, 20, 30, 0, NEWYORK);
assertEquals(4, f.parseInto(result, "2 29", 0));
assertEquals(new MutableDateTime(2004, 2, 29, 12, 20, 30, 0, NEWYORK), result);
}
use of org.joda.time.MutableDateTime in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseMutableDateTime_zone3.
public void testParseMutableDateTime_zone3() {
DateTimeFormatter h = new DateTimeFormatterBuilder().append(ISODateTimeFormat.date()).appendLiteral('T').append(ISODateTimeFormat.timeElementParser()).toFormatter();
MutableDateTime expect = null;
expect = new MutableDateTime(2004, 6, 9, 10, 20, 30, 0, LONDON);
assertEquals(expect, h.withZone(LONDON).parseMutableDateTime("2004-06-09T10:20:30"));
expect = new MutableDateTime(2004, 6, 9, 10, 20, 30, 0, LONDON);
assertEquals(expect, h.withZone(null).parseMutableDateTime("2004-06-09T10:20:30"));
expect = new MutableDateTime(2004, 6, 9, 10, 20, 30, 0, PARIS);
assertEquals(expect, h.withZone(PARIS).parseMutableDateTime("2004-06-09T10:20:30"));
}
Aggregations