use of org.joda.time.MutableDateTime in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseInto_monthDay_feb29_startOfYear.
public void testParseInto_monthDay_feb29_startOfYear() {
DateTimeFormatter f = DateTimeFormat.forPattern("M d").withLocale(Locale.UK);
MutableDateTime result = new MutableDateTime(2004, 1, 1, 0, 0, 0, 0, LONDON);
assertEquals(4, f.parseInto(result, "2 29", 0));
assertEquals(new MutableDateTime(2004, 2, 29, 0, 0, 0, 0, LONDON), result);
}
use of org.joda.time.MutableDateTime in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseInto_monthDay_feb29_tokyo_startOfYear.
public void testParseInto_monthDay_feb29_tokyo_startOfYear() {
DateTimeFormatter f = DateTimeFormat.forPattern("M d").withLocale(Locale.UK);
MutableDateTime result = new MutableDateTime(2004, 1, 1, 0, 0, 0, 0, TOKYO);
assertEquals(4, f.parseInto(result, "2 29", 0));
assertEquals(new MutableDateTime(2004, 2, 29, 0, 0, 0, 0, TOKYO), result);
}
use of org.joda.time.MutableDateTime in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseInto_monthDay_feb29_tokyo_endOfYear.
public void testParseInto_monthDay_feb29_tokyo_endOfYear() {
DateTimeFormatter f = DateTimeFormat.forPattern("M d").withLocale(Locale.UK);
MutableDateTime result = new MutableDateTime(2004, 12, 31, 23, 59, 59, 999, TOKYO);
assertEquals(4, f.parseInto(result, "2 29", 0));
assertEquals(new MutableDateTime(2004, 2, 29, 23, 59, 59, 999, TOKYO), result);
}
use of org.joda.time.MutableDateTime in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseMutableDateTime_zone2.
public void testParseMutableDateTime_zone2() {
MutableDateTime expect = null;
expect = new MutableDateTime(2004, 6, 9, 11, 20, 30, 0, LONDON);
assertEquals(expect, g.withZone(LONDON).parseMutableDateTime("2004-06-09T06:20:30-04:00"));
expect = new MutableDateTime(2004, 6, 9, 11, 20, 30, 0, LONDON);
assertEquals(expect, g.withZone(null).parseMutableDateTime("2004-06-09T06:20:30-04:00"));
expect = new MutableDateTime(2004, 6, 9, 12, 20, 30, 0, PARIS);
assertEquals(expect, g.withZone(PARIS).parseMutableDateTime("2004-06-09T06:20:30-04:00"));
}
use of org.joda.time.MutableDateTime in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseMutableDateTime_simple_precedence.
public void testParseMutableDateTime_simple_precedence() {
MutableDateTime expect = null;
// use correct day of week
expect = new MutableDateTime(2004, 6, 9, 11, 20, 30, 0, LONDON);
assertEquals(expect, f.parseDateTime("Wed 2004-06-09T10:20:30Z"));
// use wrong day of week
expect = new MutableDateTime(2004, 6, 7, 11, 20, 30, 0, LONDON);
// DayOfWeek takes precedence, because week < month in length
assertEquals(expect, f.parseDateTime("Mon 2004-06-09T10:20:30Z"));
}
Aggregations