Search in sources :

Example 1 with Chronology

use of org.joda.time.Chronology in project joda-time by JodaOrg.

the class TestEthiopicChronology method testLeap_5_13.

public void testLeap_5_13() {
    Chronology chrono = EthiopicChronology.getInstance();
    DateTime dt = new DateTime(3, 13, 5, 0, 0, chrono);
    assertEquals(true, dt.year().isLeap());
    assertEquals(true, dt.monthOfYear().isLeap());
    assertEquals(false, dt.dayOfMonth().isLeap());
    assertEquals(false, dt.dayOfYear().isLeap());
}
Also used : Chronology(org.joda.time.Chronology) DateTime(org.joda.time.DateTime)

Example 2 with Chronology

use of org.joda.time.Chronology in project joda-time by JodaOrg.

the class TestGregorianChronology method testLeap_29feb.

public void testLeap_29feb() {
    Chronology chrono = GregorianChronology.getInstance();
    DateTime dt = new DateTime(2012, 2, 29, 0, 0, chrono);
    assertEquals(true, dt.year().isLeap());
    assertEquals(true, dt.monthOfYear().isLeap());
    assertEquals(true, dt.dayOfMonth().isLeap());
    assertEquals(true, dt.dayOfYear().isLeap());
}
Also used : Chronology(org.joda.time.Chronology) DateTime(org.joda.time.DateTime)

Example 3 with Chronology

use of org.joda.time.Chronology in project joda-time by JodaOrg.

the class TestGregorianChronology method testMaximumValue.

public void testMaximumValue() {
    YearMonthDay ymd1 = new YearMonthDay(1999, DateTimeConstants.FEBRUARY, 1);
    DateMidnight dm1 = new DateMidnight(1999, DateTimeConstants.FEBRUARY, 1);
    Chronology chrono = GregorianChronology.getInstance();
    assertEquals(28, chrono.dayOfMonth().getMaximumValue(ymd1));
    assertEquals(28, chrono.dayOfMonth().getMaximumValue(dm1.getMillis()));
}
Also used : DateMidnight(org.joda.time.DateMidnight) YearMonthDay(org.joda.time.YearMonthDay) Chronology(org.joda.time.Chronology)

Example 4 with Chronology

use of org.joda.time.Chronology in project joda-time by JodaOrg.

the class TestEthiopicChronology method testLeap_6_13.

public void testLeap_6_13() {
    Chronology chrono = EthiopicChronology.getInstance();
    DateTime dt = new DateTime(3, 13, 6, 0, 0, chrono);
    assertEquals(true, dt.year().isLeap());
    assertEquals(true, dt.monthOfYear().isLeap());
    assertEquals(true, dt.dayOfMonth().isLeap());
    assertEquals(true, dt.dayOfYear().isLeap());
}
Also used : Chronology(org.joda.time.Chronology) DateTime(org.joda.time.DateTime)

Example 5 with Chronology

use of org.joda.time.Chronology in project joda-time by JodaOrg.

the class TestGJChronology method testLeap_28feb.

public void testLeap_28feb() {
    Chronology chrono = GJChronology.getInstance();
    DateTime dt = new DateTime(2012, 2, 28, 0, 0, chrono);
    assertEquals(true, dt.year().isLeap());
    assertEquals(true, dt.monthOfYear().isLeap());
    assertEquals(false, dt.dayOfMonth().isLeap());
    assertEquals(false, dt.dayOfYear().isLeap());
}
Also used : Chronology(org.joda.time.Chronology) DateTime(org.joda.time.DateTime)

Aggregations

Chronology (org.joda.time.Chronology)69 DateTime (org.joda.time.DateTime)32 ISOChronology (org.joda.time.chrono.ISOChronology)30 GJChronology (org.joda.time.chrono.GJChronology)18 BuddhistChronology (org.joda.time.chrono.BuddhistChronology)17 LocalDate (org.joda.time.LocalDate)14 DateTimeZone (org.joda.time.DateTimeZone)13 MutableDateTime (org.joda.time.MutableDateTime)7 LocalDateTime (org.joda.time.LocalDateTime)4 ReadableDateTime (org.joda.time.ReadableDateTime)4 JulianChronology (org.joda.time.chrono.JulianChronology)3 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)3 Serializable (java.io.Serializable)2 Date (java.util.Date)2 Duration (org.joda.time.Duration)2 Period (org.joda.time.Period)2 ReadableDuration (org.joda.time.ReadableDuration)2 ReadableInstant (org.joda.time.ReadableInstant)2 ReadablePartial (org.joda.time.ReadablePartial)2 Calendar (java.util.Calendar)1