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


Java JapaneseDate.with方法代码示例

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


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

示例1: test_with_TemporalField_long

import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test
public void test_with_TemporalField_long() {
    JapaneseDate base = JapaneseChronology.INSTANCE.date(JapaneseEra.SHOWA, 63, 6, 30);
    JapaneseDate test = base.with(YEAR, 1987);
    assertEquals(test, JapaneseChronology.INSTANCE.date(JapaneseEra.SHOWA, 62, 6, 30));

    test = test.with(YEAR_OF_ERA, 2);
    assertEquals(test, JapaneseChronology.INSTANCE.date(JapaneseEra.SHOWA, 2, 6, 30));

    test = test.with(ERA, JapaneseEra.HEISEI.getValue());
    assertEquals(test, JapaneseChronology.INSTANCE.date(JapaneseEra.HEISEI, 2, 6, 30));

    test = test.with(MONTH_OF_YEAR, 3);
    assertEquals(test, JapaneseChronology.INSTANCE.date(JapaneseEra.HEISEI, 2, 3, 30));

    test = test.with(DAY_OF_MONTH, 4);
    assertEquals(test, JapaneseChronology.INSTANCE.date(JapaneseEra.HEISEI, 2, 3, 4));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:TCKJapaneseChronology.java

示例2: test_withDayOfYear

import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test
public void test_withDayOfYear() {
    JapaneseDate hd = JapaneseChronology.INSTANCE.dateYearDay(1990, 1);
    for (int i = 1; i <= hd.lengthOfYear(); i++) {
        JapaneseDate 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,代码来源:TCKJapaneseChronology.java

示例3: test_adjust1

import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test
public void test_adjust1() {
    JapaneseDate base = JapaneseChronology.INSTANCE.date(1928, 10, 29);
    JapaneseDate test = base.with(TemporalAdjusters.lastDayOfMonth());
    assertEquals(test, JapaneseChronology.INSTANCE.date(1928, 10, 31));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:TCKJapaneseChronology.java

示例4: test_adjust2

import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test
public void test_adjust2() {
    JapaneseDate base = JapaneseChronology.INSTANCE.date(1928, 12, 2);
    JapaneseDate test = base.with(TemporalAdjusters.lastDayOfMonth());
    assertEquals(test, JapaneseChronology.INSTANCE.date(1928, 12, 31));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:TCKJapaneseChronology.java

示例5: test_adjust_toLocalDate

import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test
public void test_adjust_toLocalDate() {
    JapaneseDate jdate = JapaneseChronology.INSTANCE.date(1926, 1, 4);
    JapaneseDate test = jdate.with(LocalDate.of(2012, 7, 6));
    assertEquals(test, JapaneseChronology.INSTANCE.date(2012, 7, 6));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:TCKJapaneseChronology.java

示例6: test_adjust_toMonth

import java.time.chrono.JapaneseDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_adjust_toMonth() {
    JapaneseDate jdate = JapaneseChronology.INSTANCE.date(1926, 1, 4);
    jdate.with(Month.APRIL);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:TCKJapaneseChronology.java


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