use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseLocalDate_year_month_week_2011.
public void testParseLocalDate_year_month_week_2011() {
Chronology chrono = GJChronology.getInstanceUTC();
DateTimeFormatter f = DateTimeFormat.forPattern("yyyy-MM-ww").withChronology(chrono);
assertEquals(new LocalDate(2011, 1, 3, chrono), f.parseLocalDate("2011-01-01"));
}
use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseLocalDate_year_month_week_2016.
public void testParseLocalDate_year_month_week_2016() {
Chronology chrono = GJChronology.getInstanceUTC();
DateTimeFormatter f = DateTimeFormat.forPattern("yyyy-MM-ww").withChronology(chrono);
assertEquals(new LocalDate(2016, 1, 4, chrono), f.parseLocalDate("2016-01-01"));
}
use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseLocalDateTime_monthDay_feb29.
public void testParseLocalDateTime_monthDay_feb29() {
Chronology chrono = GJChronology.getInstanceUTC();
DateTimeFormatter f = DateTimeFormat.forPattern("M d H m").withChronology(chrono).withLocale(Locale.UK);
assertEquals(new LocalDateTime(2000, 2, 29, 13, 40, 0, 0, chrono), f.parseLocalDateTime("2 29 13 40"));
}
use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseLocalDate_year_month_week_2015.
public void testParseLocalDate_year_month_week_2015() {
Chronology chrono = GJChronology.getInstanceUTC();
DateTimeFormatter f = DateTimeFormat.forPattern("yyyy-MM-ww").withChronology(chrono);
// 2015-01-01 would be better, but this is OK
assertEquals(new LocalDate(2014, 12, 29, chrono), f.parseLocalDate("2015-01-01"));
}
use of org.joda.time.Chronology in project joda-time by JodaOrg.
the class TestDateTimeFormatter method testParseLocalDate_yearOfCentury.
public void testParseLocalDate_yearOfCentury() {
Chronology chrono = GJChronology.getInstanceUTC();
DateTimeFormatter f = DateTimeFormat.forPattern("yy M d").withChronology(chrono).withLocale(Locale.UK).withPivotYear(2050);
LocalDate date = new LocalDate(2050, 8, 4, chrono);
assertEquals(date, f.parseLocalDate("50 8 4"));
}
Aggregations