当前位置: 首页>>代码示例>>Java>>正文


Java MinguoDate.of方法代码示例

本文整理汇总了Java中java.time.chrono.MinguoDate.of方法的典型用法代码示例。如果您正苦于以下问题:Java MinguoDate.of方法的具体用法?Java MinguoDate.of怎么用?Java MinguoDate.of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.time.chrono.MinguoDate的用法示例。


在下文中一共展示了MinguoDate.of方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test_minguoChrono_fixedWidth

import java.time.chrono.MinguoDate; //导入方法依赖的package包/类
public void test_minguoChrono_fixedWidth() throws Exception {
    // ISO 2021 is Minguo 110
    DateTimeFormatter f = getFormatterBaseDate(YEAR, 2, 2, 2021);
    MinguoDate date = MinguoDate.of(109, 6, 30);
    assertEquals(f.format(date), "09");
    date = MinguoDate.of(110, 6, 30);
    assertEquals(f.format(date), "10");
    date = MinguoDate.of(199, 6, 30);
    assertEquals(f.format(date), "99");
    date = MinguoDate.of(200, 6, 30);
    assertEquals(f.format(date), "00");
    date = MinguoDate.of(209, 6, 30);
    assertEquals(f.format(date), "09");
    date = MinguoDate.of(210, 6, 30);
    assertEquals(f.format(date), "10");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:TestReducedPrinter.java

示例2: test_minguoChrono_extendedWidth

import java.time.chrono.MinguoDate; //导入方法依赖的package包/类
public void test_minguoChrono_extendedWidth() throws Exception {
    // ISO 2021 is Minguo 110
    DateTimeFormatter f = getFormatterBaseDate(YEAR, 2, 4, 2021);
    MinguoDate date = MinguoDate.of(109, 6, 30);
    assertEquals(f.format(date), "109");
    date = MinguoDate.of(110, 6, 30);
    assertEquals(f.format(date), "10");
    date = MinguoDate.of(199, 6, 30);
    assertEquals(f.format(date), "99");
    date = MinguoDate.of(200, 6, 30);
    assertEquals(f.format(date), "00");
    date = MinguoDate.of(209, 6, 30);
    assertEquals(f.format(date), "09");
    date = MinguoDate.of(210, 6, 30);
    assertEquals(f.format(date), "210");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:TestReducedPrinter.java

示例3: test_fieldResolvesToChronoLocalDate_overrideChrono_matches

import java.time.chrono.MinguoDate; //导入方法依赖的package包/类
@Test
public void test_fieldResolvesToChronoLocalDate_overrideChrono_matches() {
    MinguoDate mdt = MinguoDate.of(100, 6, 30);
    DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(mdt)).toFormatter();
    f = f.withChronology(MinguoChronology.INSTANCE);
    TemporalAccessor accessor = f.parse("1234567890");
    assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.from(mdt));
    assertEquals(accessor.query(TemporalQueries.localTime()), null);
    assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:TCKDateTimeParseResolver.java

示例4: data_hijrahToMinguo

import java.time.chrono.MinguoDate; //导入方法依赖的package包/类
@DataProvider(name="hijrahToMinguo")
Object[][] data_hijrahToMinguo() {
    return new Object[][] {
        {HijrahDate.of(1350,5,15), MinguoDate.of(20,9,28)},
        {HijrahDate.of(1434,5,1), MinguoDate.of(102,3,13)},
        {HijrahDate.of(1436,1,1), MinguoDate.of(103,10,25)},
        {HijrahDate.of(1500,6,12), MinguoDate.of(166,5,5)},
        {HijrahDate.of(1550,3,11), MinguoDate.of(214,8,11)},
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:TestUmmAlQuraChronology.java

示例5: test_fieldResolvesToChronoZonedDateTime_overrideChrono_matches

import java.time.chrono.MinguoDate; //导入方法依赖的package包/类
@Test
public void test_fieldResolvesToChronoZonedDateTime_overrideChrono_matches() {
    MinguoDate mdt = MinguoDate.of(100, 6, 30);
    ChronoZonedDateTime<MinguoDate> mzdt = mdt.atTime(LocalTime.NOON).atZone(EUROPE_PARIS);
    DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(mzdt)).toFormatter();
    f = f.withChronology(MinguoChronology.INSTANCE);
    TemporalAccessor accessor = f.parse("1234567890");
    assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.from(mdt));
    assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.NOON);
    assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
    assertEquals(accessor.query(TemporalQueries.zoneId()), EUROPE_PARIS);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:TCKDateTimeParseResolver.java

示例6: test_periodUntilDate

import java.time.chrono.MinguoDate; //导入方法依赖的package包/类
@Test
public void test_periodUntilDate() {
    MinguoDate mdate1 = MinguoDate.of(1970, 1, 1);
    MinguoDate mdate2 = MinguoDate.of(1971, 2, 2);
    ChronoPeriod period = mdate1.until(mdate2);
    assertEquals(period, MinguoChronology.INSTANCE.period(1, 1, 1));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:TCKMinguoChronology.java

示例7: test_periodUntilUnit

import java.time.chrono.MinguoDate; //导入方法依赖的package包/类
@Test
public void test_periodUntilUnit() {
    MinguoDate mdate1 = MinguoDate.of(1970, 1, 1);
    MinguoDate mdate2 = MinguoDate.of(1971, 2, 2);
    long months = mdate1.until(mdate2, ChronoUnit.MONTHS);
    assertEquals(months, 13);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:TCKMinguoChronology.java

示例8: test_periodUntilDiffChrono

import java.time.chrono.MinguoDate; //导入方法依赖的package包/类
@Test
public void test_periodUntilDiffChrono() {
    MinguoDate mdate1 = MinguoDate.of(1970, 1, 1);
    MinguoDate mdate2 = MinguoDate.of(1971, 2, 2);
    ThaiBuddhistDate ldate2 = ThaiBuddhistChronology.INSTANCE.date(mdate2);
    ChronoPeriod period = mdate1.until(ldate2);
    assertEquals(period, MinguoChronology.INSTANCE.period(1, 1, 1));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:TCKMinguoChronology.java

示例9: data_of_calendars

import java.time.chrono.MinguoDate; //导入方法依赖的package包/类
@DataProvider(name = "calendars")
Object[][] data_of_calendars() {
    return new Object[][]{
        {JapaneseDate.of(JapaneseEra.HEISEI, 25, 01, 05), JAPANESE_DATE_TYPE},
        {MinguoDate.of(102, 01, 05),                      MINGUO_DATE_TYPE},
        {ThaiBuddhistDate.of(2556, 01, 05),               THAIBUDDHIST_DATE_TYPE},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:TCKChronoLocalDateSerialization.java

示例10: test_fieldResolvesToChronoLocalDateTime_overrideChrono_matches

import java.time.chrono.MinguoDate; //导入方法依赖的package包/类
@Test
public void test_fieldResolvesToChronoLocalDateTime_overrideChrono_matches() {
    MinguoDate mdt = MinguoDate.of(100, 6, 30);
    DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(mdt.atTime(LocalTime.NOON))).toFormatter();
    f = f.withChronology(MinguoChronology.INSTANCE);
    TemporalAccessor accessor = f.parse("1234567890");
    assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.from(mdt));
    assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.NOON);
    assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:TCKDateTimeParseResolver.java

示例11: date

import java.time.chrono.MinguoDate; //导入方法依赖的package包/类
private static MinguoDate date(int y, int m, int d) {
    return MinguoDate.of(y, m, d);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:4,代码来源:TCKMinguoChronology.java


注:本文中的java.time.chrono.MinguoDate.of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。