• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HijrahDate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



HijrahDate类属于java.time.chrono包,在下文中一共展示了HijrahDate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: test_dateNow

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test
public void test_dateNow(){
    assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now()) ;
    assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now(ZoneId.systemDefault())) ;
    assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now(Clock.systemDefaultZone())) ;
    assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now(Clock.systemDefaultZone().getZone())) ;

    assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahChronology.INSTANCE.dateNow(ZoneId.systemDefault())) ;
    assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahChronology.INSTANCE.dateNow(Clock.systemDefaultZone())) ;
    assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahChronology.INSTANCE.dateNow(Clock.systemDefaultZone().getZone())) ;

    ZoneId zoneId = ZoneId.of("Europe/Paris");
    assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahChronology.INSTANCE.dateNow(Clock.system(zoneId))) ;
    assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahChronology.INSTANCE.dateNow(Clock.system(zoneId).getZone())) ;
    assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahDate.now(Clock.system(zoneId))) ;
    assertEquals(HijrahChronology.INSTANCE.dateNow(zoneId), HijrahDate.now(Clock.system(zoneId).getZone())) ;

    assertEquals(HijrahChronology.INSTANCE.dateNow(ZoneId.of(ZoneOffset.UTC.getId())), HijrahChronology.INSTANCE.dateNow(Clock.systemUTC())) ;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:TCKHijrahChronology.java


示例2: test_resolve_yearOfEra_eraOnly_valid

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test(dataProvider = "resolve_styleByEra")
public void test_resolve_yearOfEra_eraOnly_valid(ResolverStyle style, HijrahEra era) {
    Map<TemporalField, Long> fieldValues = new HashMap<>();
    fieldValues.put(ChronoField.ERA, (long) era.getValue());
    HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
    assertEquals(date, null);
    assertEquals(fieldValues.get(ChronoField.ERA), (Long) (long) era.getValue());
    assertEquals(fieldValues.size(), 1);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:TCKHijrahChronology.java


示例3: test_resolve_yearOfEra_eraAndYearOfEraOnly_valid

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test(dataProvider = "resolve_styleByEra")
public void test_resolve_yearOfEra_eraAndYearOfEraOnly_valid(ResolverStyle style, HijrahEra era) {
    Map<TemporalField, Long> fieldValues = new HashMap<>();
    fieldValues.put(ChronoField.ERA, (long) era.getValue());
    fieldValues.put(ChronoField.YEAR_OF_ERA, 1343L);
    HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
    assertEquals(date, null);
    assertEquals(fieldValues.get(ChronoField.ERA), null);
    assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), null);
    assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1343L);
    assertEquals(fieldValues.size(), 1);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:TCKHijrahChronology.java


示例4: test_resolve_yearOfEra_eraAndYearOnly_valid

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test(dataProvider = "resolve_styleByEra")
public void test_resolve_yearOfEra_eraAndYearOnly_valid(ResolverStyle style, HijrahEra era) {
    Map<TemporalField, Long> fieldValues = new HashMap<>();
    fieldValues.put(ChronoField.ERA, (long) era.getValue());
    fieldValues.put(ChronoField.YEAR, 1343L);
    HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
    assertEquals(date, null);
    assertEquals(fieldValues.get(ChronoField.ERA), (Long) (long) era.getValue());
    assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1343L);
    assertEquals(fieldValues.size(), 2);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:TCKHijrahChronology.java


示例5: test_resolve_yearOfEra_yearOfEraOnly_valid

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test(dataProvider = "resolve_styles")
public void test_resolve_yearOfEra_yearOfEraOnly_valid(ResolverStyle style) {
    Map<TemporalField, Long> fieldValues = new HashMap<>();
    fieldValues.put(ChronoField.YEAR_OF_ERA, 1343L);
    HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
    assertEquals(date, null);
    assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), (style != ResolverStyle.STRICT) ? null : (Long) 1343L);
    assertEquals(fieldValues.get(ChronoField.YEAR), (style == ResolverStyle.STRICT) ? null : (Long) 1343L);
    assertEquals(fieldValues.size(), 1);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:TCKHijrahChronology.java


示例6: test_resolve_yearOfEra_yearOfEraAndYearOnly_valid

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test(dataProvider = "resolve_styles")
public void test_resolve_yearOfEra_yearOfEraAndYearOnly_valid(ResolverStyle style) {
    Map<TemporalField, Long> fieldValues = new HashMap<>();
    fieldValues.put(ChronoField.YEAR_OF_ERA, 1343L);
    fieldValues.put(ChronoField.YEAR, 1343L);
    HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
    assertEquals(date, null);
    assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), null);
    assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1343L);
    assertEquals(fieldValues.size(), 1);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:TCKHijrahChronology.java


示例7: test_resolve_yd_lenient

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test(dataProvider = "resolve_yd")
public void test_resolve_yd_lenient(int y, int d, HijrahDate expected, boolean smart, boolean strict) {
    Map<TemporalField, Long> fieldValues = new HashMap<>();
    fieldValues.put(ChronoField.YEAR, (long) y);
    fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
    HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
    assertEquals(date, expected);
    assertEquals(fieldValues.size(), 0);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:TCKHijrahChronology.java


示例8: invalid_serial_classes

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@DataProvider(name = "invalidSerialformClasses")
Object[][] invalid_serial_classes() {
    return new Object[][]{
        {JapaneseEra.class},
        {JapaneseDate.class},
        {MinguoDate.class},
        {ThaiBuddhistDate.class},
        {HijrahDate.class},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:TCKChronoLocalDateSerialization.java


示例9: HijrahExample1

import java.time.chrono.HijrahDate; //导入依赖的package包/类
void HijrahExample1() {
    HijrahDate hd2 = HijrahChronology.INSTANCE.date(1200, 1, 1);

    ChronoLocalDateTime<HijrahDate> hdt = hd2.atTime(LocalTime.MIDNIGHT);
    ChronoZonedDateTime<HijrahDate> zhdt = hdt.atZone(ZoneId.of("GMT"));
    HijrahDate hd3 = zhdt.toLocalDate();
    ChronoLocalDateTime<HijrahDate> hdt2 = zhdt.toLocalDateTime();
    HijrahDate hd4 = hdt2.toLocalDate();

    HijrahDate hd5 = next(hd2);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:TestExampleCode.java


示例10: test_library

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test
public void test_library() {
    HijrahDate date = HijrahDate.now();
    HijrahDate next = next(date);
    ChronoLocalDateTime<HijrahDate> noonTomorrow = tomorrowNoon(date);
    HijrahDate hd3 = noonTomorrow.toLocalDate();
    System.out.printf("  now: %s, noon tomorrow: %s%n", date, noonTomorrow);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:TestExampleCode.java


示例11: data_UmmAlQuraVsISODates

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@DataProvider(name = "UmmAlQuraVsISODates")
Object[][] data_UmmAlQuraVsISODates() {
    return new Object[][] {
        {HijrahDate.of(1318, 1, 1), LocalDate.of(1900, 04, 30)},
        {HijrahDate.of(1318, 12, 29), LocalDate.of(1901, 04, 19)},
        {HijrahDate.of(1319, 01, 01), LocalDate.of(1901, 04, 20)},
        {HijrahDate.of(1433, 12, 29), LocalDate.of(2012, 11, 14)},
        {HijrahDate.of(1434, 01, 01), LocalDate.of(2012, 11, 15)},
        {HijrahDate.of(1434, 02, 18), LocalDate.of(2012, 12, 31)},
        {HijrahDate.of(1502, 12, 29), LocalDate.of(2079, 10, 25)},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:TestUmmAlQuraChronology.java


示例12: data_dates

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@DataProvider(name = "dates")
Object[][] data_dates() {
    return new Object[][]{
        {HijrahDate.of(1300, 5, 1), 1300, 1600, 1, 12, 1, 30, 30},
        {HijrahDate.of(1300, 6, 1), 1300, 1600, 1, 12, 1, 29, 30},
        {HijrahDate.of(1434, 12, 1), 1300, 1600, 1, 12, 1, 29, 30},
        {HijrahDate.of(1500, 4, 1), 1300, 1600, 1, 12, 1, 30, 30},
        {HijrahDate.of(1600, 6, 1), 1300, 1600, 1, 12, 1, 29, 30},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:TestUmmAlQuraChronology.java


示例13: Test_UmmAlQuraRanges

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test(dataProvider="dates")
public void Test_UmmAlQuraRanges(HijrahDate date,
                    int minYear, int maxYear,
                    int minMonth, int maxMonth,
                    int minDay, int maxDay, int maxChronoDay) {
    // Check the chronology ranges
    HijrahChronology chrono = date.getChronology();
    ValueRange yearRange = chrono.range(YEAR);
    assertEquals(yearRange.getMinimum(), minYear, "Minimum year for Hijrah chronology");
    assertEquals(yearRange.getLargestMinimum(), minYear, "Largest minimum year for Hijrah chronology");
    assertEquals(yearRange.getMaximum(), maxYear, "Maximum year for Hijrah chronology");
    assertEquals(yearRange.getSmallestMaximum(), maxYear, "Smallest Maximum year for Hijrah chronology");

    ValueRange monthRange = chrono.range(MONTH_OF_YEAR);
    assertEquals(monthRange.getMinimum(), minMonth, "Minimum month for Hijrah chronology");
    assertEquals(monthRange.getMaximum(), maxMonth, "Maximum month for Hijrah chronology");

    ValueRange daysRange = chrono.range(DAY_OF_MONTH);
    assertEquals(daysRange.getMinimum(), minDay, "Minimum day for chronology");
    assertEquals(daysRange.getMaximum(), maxChronoDay, "Maximum day for Hijrah chronology");

    // Check the date ranges
    yearRange = date.range(YEAR);
    assertEquals(yearRange.getMinimum(), minYear, "Minimum year for Hijrah date");
    assertEquals(yearRange.getLargestMinimum(), minYear, "Largest minimum  year for Hijrah date");
    assertEquals(yearRange.getMaximum(), maxYear, "Maximum year for Hijrah date");
    assertEquals(yearRange.getSmallestMaximum(), maxYear, "Smallest maximum year for Hijrah date");

    monthRange = date.range(MONTH_OF_YEAR);
    assertEquals(monthRange.getMinimum(), minMonth, "Minimum month for HijrahDate");
    assertEquals(monthRange.getMaximum(), maxMonth, "Maximum month for HijrahDate");

    daysRange = date.range(DAY_OF_MONTH);
    assertEquals(daysRange.getMinimum(), minDay, "Minimum day for HijrahDate");
    assertEquals(daysRange.getMaximum(), maxDay, "Maximum day for HijrahDate");

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:38,代码来源:TestUmmAlQuraChronology.java


示例14: test_getDayOfYear

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test
public void test_getDayOfYear() {
    HijrahDate hd1 = HijrahChronology.INSTANCE.dateYearDay(1434, 1);
    for (int i = 1; i <= hd1.lengthOfYear(); i++) {
        HijrahDate hd = HijrahChronology.INSTANCE.dateYearDay(1434, i);
        int doy = hd.get(DAY_OF_YEAR);
        assertEquals(doy, i, "get(DAY_OF_YEAR) incorrect for " + i);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:TestUmmAlQuraChronology.java


示例15: test_withDayOfYear

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test
public void test_withDayOfYear() {
    HijrahDate hd = HijrahChronology.INSTANCE.dateYearDay(1434, 1);
    for (int i = 1; i <= hd.lengthOfYear(); i++) {
        HijrahDate hd2 = hd.with(DAY_OF_YEAR, i);
        int doy = hd2.get(DAY_OF_YEAR);
        assertEquals(doy, i, "with(DAY_OF_YEAR) incorrect for " + i + " " + hd2);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:TestUmmAlQuraChronology.java


示例16: test_adjustWithDayOfWeek

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test
public void test_adjustWithDayOfWeek() {
    assertEquals(HijrahChronology.INSTANCE.date(1320, 1, 15).with(ChronoField.DAY_OF_WEEK, 4), HijrahDate.of(1320, 1, 15));
    assertEquals(HijrahChronology.INSTANCE.date(1421, 11, 15).with(ChronoField.DAY_OF_WEEK, 1), HijrahDate.of(1421, 11, 11));
    assertEquals(HijrahChronology.INSTANCE.date(1529, 7, 18).with(ChronoField.DAY_OF_WEEK, 6), HijrahDate.of(1529, 7, 20));
    assertEquals(HijrahChronology.INSTANCE.date(1534, 2, 10).with(ChronoField.DAY_OF_WEEK, 5), HijrahDate.of(1534, 2, 12));
    assertEquals(HijrahChronology.INSTANCE.date(1552, 4, 1).with(ChronoField.DAY_OF_WEEK, 2), HijrahDate.of(1552, 3, 26));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:TestUmmAlQuraChronology.java


示例17: test_adjustWithDayOfMonth

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test
public void test_adjustWithDayOfMonth() {
    assertEquals(HijrahChronology.INSTANCE.date(1320, 1, 15).with(ChronoField.DAY_OF_MONTH, 2), HijrahDate.of(1320, 1, 2));
    assertEquals(HijrahChronology.INSTANCE.date(1421, 11, 15).with(ChronoField.DAY_OF_MONTH, 9), HijrahDate.of(1421, 11, 9));
    assertEquals(HijrahChronology.INSTANCE.date(1529, 7, 18).with(ChronoField.DAY_OF_MONTH, 13), HijrahDate.of(1529, 7, 13));
    assertEquals(HijrahChronology.INSTANCE.date(1534, 12, 10).with(ChronoField.DAY_OF_MONTH, 29), HijrahDate.of(1534, 12, 29));
    assertEquals(HijrahChronology.INSTANCE.date(1552, 4, 1).with(ChronoField.DAY_OF_MONTH, 6), HijrahDate.of(1552, 4, 6));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:TestUmmAlQuraChronology.java


示例18: test_adjustWithDayOfYear

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@Test
public void test_adjustWithDayOfYear() {
    assertEquals(HijrahChronology.INSTANCE.date(1320, 1, 15).with(ChronoField.DAY_OF_YEAR, 24), HijrahDate.of(1320, 1, 24));
    assertEquals(HijrahChronology.INSTANCE.date(1421, 11, 15).with(ChronoField.DAY_OF_YEAR, 135), HijrahDate.of(1421, 5, 18));
    assertEquals(HijrahChronology.INSTANCE.date(1529, 7, 18).with(ChronoField.DAY_OF_YEAR, 64), HijrahDate.of(1529, 3, 5));
    assertEquals(HijrahChronology.INSTANCE.date(1534, 2, 10).with(ChronoField.DAY_OF_YEAR, 354), HijrahDate.of(1534, 12, 29));
    assertEquals(HijrahChronology.INSTANCE.date(1552, 4, 1).with(ChronoField.DAY_OF_YEAR, 291), HijrahDate.of(1552, 10, 26));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:TestUmmAlQuraChronology.java


示例19: data_datesForDiffs

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@DataProvider(name="datesForDiff")
Object[][] data_datesForDiffs() {
    return new Object[][] {
        {HijrahDate.of(1350, 5, 15), HijrahDate.of(1351, 12, 29), 574, 19, 1},
        {HijrahDate.of(1434, 5, 1), HijrahDate.of(1434,6, 12), 40, 1, 0},
        {HijrahDate.of(1436, 1, 1), HijrahDate.of(1475, 12, 29), 14173, 479, 39},
        {HijrahDate.of(1500, 6, 12), HijrahDate.of(1551, 7, 12), 18102, 613, 51},
        {HijrahDate.of(1550, 3, 11), HijrahDate.of(1551, 4, 11), 384, 13, 1},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:TestUmmAlQuraChronology.java


示例20: data_Period

import java.time.chrono.HijrahDate; //导入依赖的package包/类
@DataProvider(name="datesForPeriod")
Object[][] data_Period() {
    return new Object[][] {
        {HijrahDate.of(1350, 5, 15), HijrahDate.of(1434, 7, 20), HijrahChronology.INSTANCE.period(84, 2, 5)},
        {HijrahDate.of(1403, 5, 28), HijrahDate.of(1434, 7, 20), HijrahChronology.INSTANCE.period(31, 1, 22)},
        {HijrahDate.of(1434, 7, 20), HijrahDate.of(1484, 2, 15), HijrahChronology.INSTANCE.period(49, 6, 24)},
        {HijrahDate.of(1500, 6, 12), HijrahDate.of(1450, 4, 21), HijrahChronology.INSTANCE.period(-50, -1, -20)},
        {HijrahDate.of(1549, 3, 11), HijrahDate.of(1550, 3, 10), HijrahChronology.INSTANCE.period(0, 11, 28)},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:TestUmmAlQuraChronology.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PhpReference类代码示例发布时间:2022-05-22
下一篇:
Java RepositoryService类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap