Search in sources :

Example 11 with ChronoZonedDateTime

use of java.time.chrono.ChronoZonedDateTime in project jdk8u_jdk by JetBrains.

the class TCKMinguoChronology method test_Instant_zonedDateTime.

//-----------------------------------------------------------------------
// zonedDateTime(Instant, ZoneId )
//-----------------------------------------------------------------------
@Test
public void test_Instant_zonedDateTime() {
    OffsetDateTime offsetDateTime = OffsetDateTime.of(2012, 2, 29, 2, 7, 1, 1, OFFSET_PTWO);
    ZonedDateTime zonedDateTime = ZonedDateTime.of(2012, 2, 29, 2, 7, 1, 1, ZONE_PARIS);
    ChronoZonedDateTime<MinguoDate> result = MinguoChronology.INSTANCE.zonedDateTime(offsetDateTime.toInstant(), offsetDateTime.getOffset());
    assertEquals(result.toLocalDate(), MinguoChronology.INSTANCE.date(MinguoEra.ROC, 2012 - YDIFF, 2, 29));
    assertEquals(result.toLocalTime(), LocalTime.of(2, 7, 1, 1));
    result = MinguoChronology.INSTANCE.zonedDateTime(zonedDateTime.toInstant(), zonedDateTime.getOffset());
    assertEquals(result.toLocalDate(), MinguoChronology.INSTANCE.date(MinguoEra.ROC, 2012 - YDIFF, 2, 29));
    assertEquals(result.toLocalTime(), LocalTime.of(2, 7, 1, 1));
}
Also used : MinguoDate(java.time.chrono.MinguoDate) OffsetDateTime(java.time.OffsetDateTime) ZonedDateTime(java.time.ZonedDateTime) ChronoZonedDateTime(java.time.chrono.ChronoZonedDateTime) Test(org.testng.annotations.Test)

Aggregations

ChronoZonedDateTime (java.time.chrono.ChronoZonedDateTime)11 ZonedDateTime (java.time.ZonedDateTime)8 OffsetDateTime (java.time.OffsetDateTime)6 Test (org.testng.annotations.Test)6 Instant (java.time.Instant)2 LocalTime (java.time.LocalTime)2 ChronoLocalDate (java.time.chrono.ChronoLocalDate)2 Chronology (java.time.chrono.Chronology)2 DateTimeException (java.time.DateTimeException)1 LocalDate (java.time.LocalDate)1 LocalDateTime (java.time.LocalDateTime)1 OffsetTime (java.time.OffsetTime)1 YearMonth (java.time.YearMonth)1 ChronoLocalDateTime (java.time.chrono.ChronoLocalDateTime)1 HijrahChronology (java.time.chrono.HijrahChronology)1 HijrahDate (java.time.chrono.HijrahDate)1 IsoChronology (java.time.chrono.IsoChronology)1 JapaneseChronology (java.time.chrono.JapaneseChronology)1 MinguoChronology (java.time.chrono.MinguoChronology)1 MinguoDate (java.time.chrono.MinguoDate)1