java.time.chrono.ThaiBuddhistDate#get ( )源码实例Demo

下面列出了java.time.chrono.ThaiBuddhistDate#get ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: TencentKona-8   文件: TestReducedParser.java
@Test
public void test_reducedWithLateChronoChange() {
    ThaiBuddhistDate date = ThaiBuddhistDate.of(2543, 1, 1);
    DateTimeFormatter df
            = new DateTimeFormatterBuilder()
                    .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
                    .appendLiteral(" ")
                    .appendChronologyId()
            .toFormatter();
    int expected = date.get(YEAR);
    String input = df.format(date);

    ParsePosition pos = new ParsePosition(0);
    TemporalAccessor parsed = df.parseUnresolved(input, pos);
    assertEquals(pos.getIndex(), input.length(), "Input not parsed completely");
    assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
    int actual = parsed.get(YEAR);
    assertEquals(actual, expected,
            String.format("Wrong date parsed, chrono: %s, input: %s",
            parsed.query(TemporalQueries.chronology()), input));

}
 
源代码2 项目: jdk8u60   文件: TestReducedParser.java
@Test
public void test_reducedWithLateChronoChange() {
    ThaiBuddhistDate date = ThaiBuddhistDate.of(2543, 1, 1);
    DateTimeFormatter df
            = new DateTimeFormatterBuilder()
                    .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
                    .appendLiteral(" ")
                    .appendChronologyId()
            .toFormatter();
    int expected = date.get(YEAR);
    String input = df.format(date);

    ParsePosition pos = new ParsePosition(0);
    TemporalAccessor parsed = df.parseUnresolved(input, pos);
    assertEquals(pos.getIndex(), input.length(), "Input not parsed completely");
    assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
    int actual = parsed.get(YEAR);
    assertEquals(actual, expected,
            String.format("Wrong date parsed, chrono: %s, input: %s",
            parsed.query(TemporalQueries.chronology()), input));

}
 
源代码3 项目: openjdk-jdk8u   文件: TestReducedParser.java
@Test
public void test_reducedWithLateChronoChange() {
    ThaiBuddhistDate date = ThaiBuddhistDate.of(2543, 1, 1);
    DateTimeFormatter df
            = new DateTimeFormatterBuilder()
                    .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
                    .appendLiteral(" ")
                    .appendChronologyId()
            .toFormatter();
    int expected = date.get(YEAR);
    String input = df.format(date);

    ParsePosition pos = new ParsePosition(0);
    TemporalAccessor parsed = df.parseUnresolved(input, pos);
    assertEquals(pos.getIndex(), input.length(), "Input not parsed completely");
    assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
    int actual = parsed.get(YEAR);
    assertEquals(actual, expected,
            String.format("Wrong date parsed, chrono: %s, input: %s",
            parsed.query(TemporalQueries.chronology()), input));

}
 
源代码4 项目: openjdk-jdk8u-backup   文件: TestReducedParser.java
@Test
public void test_reducedWithLateChronoChange() {
    ThaiBuddhistDate date = ThaiBuddhistDate.of(2543, 1, 1);
    DateTimeFormatter df
            = new DateTimeFormatterBuilder()
                    .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
                    .appendLiteral(" ")
                    .appendChronologyId()
            .toFormatter();
    int expected = date.get(YEAR);
    String input = df.format(date);

    ParsePosition pos = new ParsePosition(0);
    TemporalAccessor parsed = df.parseUnresolved(input, pos);
    assertEquals(pos.getIndex(), input.length(), "Input not parsed completely");
    assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
    int actual = parsed.get(YEAR);
    assertEquals(actual, expected,
            String.format("Wrong date parsed, chrono: %s, input: %s",
            parsed.query(TemporalQueries.chronology()), input));

}
 
源代码5 项目: openjdk-jdk9   文件: TestReducedParser.java
@Test
public void test_reducedWithLateChronoChange() {
    ThaiBuddhistDate date = ThaiBuddhistDate.of(2543, 1, 1);
    DateTimeFormatter df
            = new DateTimeFormatterBuilder()
                    .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
                    .appendLiteral(" ")
                    .appendChronologyId()
            .toFormatter();
    int expected = date.get(YEAR);
    String input = df.format(date);

    ParsePosition pos = new ParsePosition(0);
    TemporalAccessor parsed = df.parseUnresolved(input, pos);
    assertEquals(pos.getIndex(), input.length(), "Input not parsed completely");
    assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
    int actual = parsed.get(YEAR);
    assertEquals(actual, expected,
            String.format("Wrong date parsed, chrono: %s, input: %s",
            parsed.query(TemporalQueries.chronology()), input));

}
 
源代码6 项目: jdk8u-jdk   文件: TestReducedParser.java
@Test
public void test_reducedWithLateChronoChange() {
    ThaiBuddhistDate date = ThaiBuddhistDate.of(2543, 1, 1);
    DateTimeFormatter df
            = new DateTimeFormatterBuilder()
                    .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
                    .appendLiteral(" ")
                    .appendChronologyId()
            .toFormatter();
    int expected = date.get(YEAR);
    String input = df.format(date);

    ParsePosition pos = new ParsePosition(0);
    TemporalAccessor parsed = df.parseUnresolved(input, pos);
    assertEquals(pos.getIndex(), input.length(), "Input not parsed completely");
    assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
    int actual = parsed.get(YEAR);
    assertEquals(actual, expected,
            String.format("Wrong date parsed, chrono: %s, input: %s",
            parsed.query(TemporalQueries.chronology()), input));

}
 
源代码7 项目: hottub   文件: TestReducedParser.java
@Test
public void test_reducedWithLateChronoChange() {
    ThaiBuddhistDate date = ThaiBuddhistDate.of(2543, 1, 1);
    DateTimeFormatter df
            = new DateTimeFormatterBuilder()
                    .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
                    .appendLiteral(" ")
                    .appendChronologyId()
            .toFormatter();
    int expected = date.get(YEAR);
    String input = df.format(date);

    ParsePosition pos = new ParsePosition(0);
    TemporalAccessor parsed = df.parseUnresolved(input, pos);
    assertEquals(pos.getIndex(), input.length(), "Input not parsed completely");
    assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
    int actual = parsed.get(YEAR);
    assertEquals(actual, expected,
            String.format("Wrong date parsed, chrono: %s, input: %s",
            parsed.query(TemporalQueries.chronology()), input));

}
 
源代码8 项目: jdk8u_jdk   文件: TestReducedParser.java
@Test
public void test_reducedWithLateChronoChange() {
    ThaiBuddhistDate date = ThaiBuddhistDate.of(2543, 1, 1);
    DateTimeFormatter df
            = new DateTimeFormatterBuilder()
                    .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
                    .appendLiteral(" ")
                    .appendChronologyId()
            .toFormatter();
    int expected = date.get(YEAR);
    String input = df.format(date);

    ParsePosition pos = new ParsePosition(0);
    TemporalAccessor parsed = df.parseUnresolved(input, pos);
    assertEquals(pos.getIndex(), input.length(), "Input not parsed completely");
    assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
    int actual = parsed.get(YEAR);
    assertEquals(actual, expected,
            String.format("Wrong date parsed, chrono: %s, input: %s",
            parsed.query(TemporalQueries.chronology()), input));

}
 
源代码9 项目: openjdk-8-source   文件: TestReducedParser.java
@Test
public void test_reducedWithLateChronoChange() {
    ThaiBuddhistDate date = ThaiBuddhistDate.of(2543, 1, 1);
    DateTimeFormatter df
            = new DateTimeFormatterBuilder()
                    .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
                    .appendLiteral(" ")
                    .appendChronologyId()
            .toFormatter();
    int expected = date.get(YEAR);
    String input = df.format(date);

    ParsePosition pos = new ParsePosition(0);
    TemporalAccessor parsed = df.parseUnresolved(input, pos);
    assertEquals(pos.getIndex(), input.length(), "Input not parsed completely");
    assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
    int actual = parsed.get(YEAR);
    assertEquals(actual, expected,
            String.format("Wrong date parsed, chrono: %s, input: %s",
            parsed.query(TemporalQueries.chronology()), input));

}
 
源代码10 项目: jdk8u-jdk   文件: TestReducedParser.java
@Test
public void test_reducedWithLateChronoChange() {
    ThaiBuddhistDate date = ThaiBuddhistDate.of(2543, 1, 1);
    DateTimeFormatter df
            = new DateTimeFormatterBuilder()
                    .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
                    .appendLiteral(" ")
                    .appendChronologyId()
            .toFormatter();
    int expected = date.get(YEAR);
    String input = df.format(date);

    ParsePosition pos = new ParsePosition(0);
    TemporalAccessor parsed = df.parseUnresolved(input, pos);
    assertEquals(pos.getIndex(), input.length(), "Input not parsed completely");
    assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
    int actual = parsed.get(YEAR);
    assertEquals(actual, expected,
            String.format("Wrong date parsed, chrono: %s, input: %s",
            parsed.query(TemporalQueries.chronology()), input));

}
 
源代码11 项目: openjdk-8   文件: TestReducedParser.java
@Test
public void test_reducedWithLateChronoChange() {
    ThaiBuddhistDate date = ThaiBuddhistDate.of(2543, 1, 1);
    DateTimeFormatter df
            = new DateTimeFormatterBuilder()
                    .appendValueReduced(YEAR, 2, 2, LocalDate.of(2000, 1, 1))
                    .appendLiteral(" ")
                    .appendChronologyId()
            .toFormatter();
    int expected = date.get(YEAR);
    String input = df.format(date);

    ParsePosition pos = new ParsePosition(0);
    TemporalAccessor parsed = df.parseUnresolved(input, pos);
    assertEquals(pos.getIndex(), input.length(), "Input not parsed completely");
    assertEquals(pos.getErrorIndex(), -1, "Error index should be -1 (no-error)");
    int actual = parsed.get(YEAR);
    assertEquals(actual, expected,
            String.format("Wrong date parsed, chrono: %s, input: %s",
            parsed.query(TemporalQueries.chronology()), input));

}
 
源代码12 项目: jdk8u_jdk   文件: TestExampleCode.java
@Test
public void test_calendarPackageExample() {

    // Enumerate the list of available calendars and print today for each
    Set<Chronology> chronos = Chronology.getAvailableChronologies();
    for (Chronology chrono : chronos) {
        ChronoLocalDate date = chrono.dateNow();
        System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
    }

    // Print the Thai Buddhist date
    ThaiBuddhistDate now1 = ThaiBuddhistDate.now();
    int day = now1.get(ChronoField.DAY_OF_MONTH);
    int dow = now1.get(ChronoField.DAY_OF_WEEK);
    int month = now1.get(ChronoField.MONTH_OF_YEAR);
    int year = now1.get(ChronoField.YEAR);
    System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
            dow, day, month, year);

    // Print today's date and the last day of the year for the Thai Buddhist Calendar.
    ThaiBuddhistDate first = now1
            .with(ChronoField.DAY_OF_MONTH, 1)
            .with(ChronoField.MONTH_OF_YEAR, 1);
    ThaiBuddhistDate last = first
            .plus(1, ChronoUnit.YEARS)
            .minus(1, ChronoUnit.DAYS);
    System.out.printf("  %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(),
            first, last);
}
 
源代码13 项目: dragonwell8_jdk   文件: TestExampleCode.java
@Test
public void test_calendarPackageExample() {

    // Enumerate the list of available calendars and print today for each
    Set<Chronology> chronos = Chronology.getAvailableChronologies();
    for (Chronology chrono : chronos) {
        ChronoLocalDate date = chrono.dateNow();
        System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
    }

    // Print the Thai Buddhist date
    ThaiBuddhistDate now1 = ThaiBuddhistDate.now();
    int day = now1.get(ChronoField.DAY_OF_MONTH);
    int dow = now1.get(ChronoField.DAY_OF_WEEK);
    int month = now1.get(ChronoField.MONTH_OF_YEAR);
    int year = now1.get(ChronoField.YEAR);
    System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
            dow, day, month, year);

    // Print today's date and the last day of the year for the Thai Buddhist Calendar.
    ThaiBuddhistDate first = now1
            .with(ChronoField.DAY_OF_MONTH, 1)
            .with(ChronoField.MONTH_OF_YEAR, 1);
    ThaiBuddhistDate last = first
            .plus(1, ChronoUnit.YEARS)
            .minus(1, ChronoUnit.DAYS);
    System.out.printf("  %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(),
            first, last);
}
 
源代码14 项目: TencentKona-8   文件: TestExampleCode.java
@Test
public void test_calendarPackageExample() {

    // Enumerate the list of available calendars and print today for each
    Set<Chronology> chronos = Chronology.getAvailableChronologies();
    for (Chronology chrono : chronos) {
        ChronoLocalDate date = chrono.dateNow();
        System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
    }

    // Print the Thai Buddhist date
    ThaiBuddhistDate now1 = ThaiBuddhistDate.now();
    int day = now1.get(ChronoField.DAY_OF_MONTH);
    int dow = now1.get(ChronoField.DAY_OF_WEEK);
    int month = now1.get(ChronoField.MONTH_OF_YEAR);
    int year = now1.get(ChronoField.YEAR);
    System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
            dow, day, month, year);

    // Print today's date and the last day of the year for the Thai Buddhist Calendar.
    ThaiBuddhistDate first = now1
            .with(ChronoField.DAY_OF_MONTH, 1)
            .with(ChronoField.MONTH_OF_YEAR, 1);
    ThaiBuddhistDate last = first
            .plus(1, ChronoUnit.YEARS)
            .minus(1, ChronoUnit.DAYS);
    System.out.printf("  %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(),
            first, last);
}
 
源代码15 项目: jdk8u60   文件: TestExampleCode.java
@Test
public void test_calendarPackageExample() {

    // Enumerate the list of available calendars and print today for each
    Set<Chronology> chronos = Chronology.getAvailableChronologies();
    for (Chronology chrono : chronos) {
        ChronoLocalDate date = chrono.dateNow();
        System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
    }

    // Print the Thai Buddhist date
    ThaiBuddhistDate now1 = ThaiBuddhistDate.now();
    int day = now1.get(ChronoField.DAY_OF_MONTH);
    int dow = now1.get(ChronoField.DAY_OF_WEEK);
    int month = now1.get(ChronoField.MONTH_OF_YEAR);
    int year = now1.get(ChronoField.YEAR);
    System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
            dow, day, month, year);

    // Print today's date and the last day of the year for the Thai Buddhist Calendar.
    ThaiBuddhistDate first = now1
            .with(ChronoField.DAY_OF_MONTH, 1)
            .with(ChronoField.MONTH_OF_YEAR, 1);
    ThaiBuddhistDate last = first
            .plus(1, ChronoUnit.YEARS)
            .minus(1, ChronoUnit.DAYS);
    System.out.printf("  %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(),
            first, last);
}
 
源代码16 项目: jdk8u-dev-jdk   文件: TestExampleCode.java
@Test
public void test_calendarPackageExample() {

    // Enumerate the list of available calendars and print today for each
    Set<Chronology> chronos = Chronology.getAvailableChronologies();
    for (Chronology chrono : chronos) {
        ChronoLocalDate date = chrono.dateNow();
        System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
    }

    // Print the Thai Buddhist date
    ThaiBuddhistDate now1 = ThaiBuddhistDate.now();
    int day = now1.get(ChronoField.DAY_OF_MONTH);
    int dow = now1.get(ChronoField.DAY_OF_WEEK);
    int month = now1.get(ChronoField.MONTH_OF_YEAR);
    int year = now1.get(ChronoField.YEAR);
    System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
            dow, day, month, year);

    // Print today's date and the last day of the year for the Thai Buddhist Calendar.
    ThaiBuddhistDate first = now1
            .with(ChronoField.DAY_OF_MONTH, 1)
            .with(ChronoField.MONTH_OF_YEAR, 1);
    ThaiBuddhistDate last = first
            .plus(1, ChronoUnit.YEARS)
            .minus(1, ChronoUnit.DAYS);
    System.out.printf("  %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(),
            first, last);
}
 
源代码17 项目: openjdk-jdk8u-backup   文件: TestExampleCode.java
@Test
public void test_calendarPackageExample() {

    // Enumerate the list of available calendars and print today for each
    Set<Chronology> chronos = Chronology.getAvailableChronologies();
    for (Chronology chrono : chronos) {
        ChronoLocalDate date = chrono.dateNow();
        System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
    }

    // Print the Thai Buddhist date
    ThaiBuddhistDate now1 = ThaiBuddhistDate.now();
    int day = now1.get(ChronoField.DAY_OF_MONTH);
    int dow = now1.get(ChronoField.DAY_OF_WEEK);
    int month = now1.get(ChronoField.MONTH_OF_YEAR);
    int year = now1.get(ChronoField.YEAR);
    System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
            dow, day, month, year);

    // Print today's date and the last day of the year for the Thai Buddhist Calendar.
    ThaiBuddhistDate first = now1
            .with(ChronoField.DAY_OF_MONTH, 1)
            .with(ChronoField.MONTH_OF_YEAR, 1);
    ThaiBuddhistDate last = first
            .plus(1, ChronoUnit.YEARS)
            .minus(1, ChronoUnit.DAYS);
    System.out.printf("  %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(),
            first, last);
}
 
源代码18 项目: openjdk-jdk9   文件: TestExampleCode.java
@Test
public void test_calendarPackageExample() {

    // Enumerate the list of available calendars and print today for each
    Set<Chronology> chronos = Chronology.getAvailableChronologies();
    for (Chronology chrono : chronos) {
        ChronoLocalDate date = chrono.dateNow();
        System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
    }

    // Print the Thai Buddhist date
    ThaiBuddhistDate now1 = ThaiBuddhistDate.now();
    int day = now1.get(ChronoField.DAY_OF_MONTH);
    int dow = now1.get(ChronoField.DAY_OF_WEEK);
    int month = now1.get(ChronoField.MONTH_OF_YEAR);
    int year = now1.get(ChronoField.YEAR);
    System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
            dow, day, month, year);

    // Print today's date and the last day of the year for the Thai Buddhist Calendar.
    ThaiBuddhistDate first = now1
            .with(ChronoField.DAY_OF_MONTH, 1)
            .with(ChronoField.MONTH_OF_YEAR, 1);
    ThaiBuddhistDate last = first
            .plus(1, ChronoUnit.YEARS)
            .minus(1, ChronoUnit.DAYS);
    System.out.printf("  %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(),
            first, last);
}
 
源代码19 项目: jdk8u-jdk   文件: TestExampleCode.java
@Test
public void test_calendarPackageExample() {

    // Enumerate the list of available calendars and print today for each
    Set<Chronology> chronos = Chronology.getAvailableChronologies();
    for (Chronology chrono : chronos) {
        ChronoLocalDate date = chrono.dateNow();
        System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
    }

    // Print the Thai Buddhist date
    ThaiBuddhistDate now1 = ThaiBuddhistDate.now();
    int day = now1.get(ChronoField.DAY_OF_MONTH);
    int dow = now1.get(ChronoField.DAY_OF_WEEK);
    int month = now1.get(ChronoField.MONTH_OF_YEAR);
    int year = now1.get(ChronoField.YEAR);
    System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
            dow, day, month, year);

    // Print today's date and the last day of the year for the Thai Buddhist Calendar.
    ThaiBuddhistDate first = now1
            .with(ChronoField.DAY_OF_MONTH, 1)
            .with(ChronoField.MONTH_OF_YEAR, 1);
    ThaiBuddhistDate last = first
            .plus(1, ChronoUnit.YEARS)
            .minus(1, ChronoUnit.DAYS);
    System.out.printf("  %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(),
            first, last);
}
 
源代码20 项目: openjdk-8   文件: TestExampleCode.java
@Test
public void test_calendarPackageExample() {

    // Enumerate the list of available calendars and print today for each
    Set<Chronology> chronos = Chronology.getAvailableChronologies();
    for (Chronology chrono : chronos) {
        ChronoLocalDate date = chrono.dateNow();
        System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
    }

    // Print the Thai Buddhist date
    ThaiBuddhistDate now1 = ThaiBuddhistDate.now();
    int day = now1.get(ChronoField.DAY_OF_MONTH);
    int dow = now1.get(ChronoField.DAY_OF_WEEK);
    int month = now1.get(ChronoField.MONTH_OF_YEAR);
    int year = now1.get(ChronoField.YEAR);
    System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
            dow, day, month, year);

    // Print today's date and the last day of the year for the Thai Buddhist Calendar.
    ThaiBuddhistDate first = now1
            .with(ChronoField.DAY_OF_MONTH, 1)
            .with(ChronoField.MONTH_OF_YEAR, 1);
    ThaiBuddhistDate last = first
            .plus(1, ChronoUnit.YEARS)
            .minus(1, ChronoUnit.DAYS);
    System.out.printf("  %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(),
            first, last);
}