Java Code Examples for java.time.chrono.ThaiBuddhistDate#now()
The following examples show how to use
java.time.chrono.ThaiBuddhistDate#now() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestExampleCode.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@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); }
Example 2
Source File: TCKThaiBuddhistChronology.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="prolepticYear") public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) { assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear) ; assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear - YDIFF).isLeap()); ThaiBuddhistDate jdate = ThaiBuddhistDate.now(); jdate = jdate.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2); if (isLeapYear) { assertEquals(jdate.lengthOfMonth(), 29); } else { assertEquals(jdate.lengthOfMonth(), 28); } }
Example 3
Source File: TestChronoLocalDate.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void test_date_checkGenerics_genericsMethod_concreteType() { ThaiBuddhistChronology chrono = ThaiBuddhistChronology.INSTANCE; ThaiBuddhistDate date = chrono.dateNow(); date = ThaiBuddhistDate.now(); date = processOK(date); date = processClassOK(ThaiBuddhistDate.class); date = dateSupplier(); // date = processClassWeird(ThaiBuddhistDate.class); // does not compile (correct) }
Example 4
Source File: TestExampleCode.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@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); }
Example 5
Source File: TestTextParserWithLocale.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="parseChronoLocalDate") Object[][] provider_chronoLocalDate() { return new Object[][] { { HijrahDate.now() }, { JapaneseDate.now() }, { MinguoDate.now() }, { ThaiBuddhistDate.now() }}; }
Example 6
Source File: TCKThaiBuddhistChronology.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="prolepticYear") public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) { assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear) ; assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear - YDIFF).isLeap()); ThaiBuddhistDate jdate = ThaiBuddhistDate.now(); jdate = jdate.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2); if (isLeapYear) { assertEquals(jdate.lengthOfMonth(), 29); } else { assertEquals(jdate.lengthOfMonth(), 28); } }
Example 7
Source File: TestChronoLocalDate.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void test_date_checkGenerics_genericsMethod_concreteType() { ThaiBuddhistChronology chrono = ThaiBuddhistChronology.INSTANCE; ThaiBuddhistDate date = chrono.dateNow(); date = ThaiBuddhistDate.now(); date = processOK(date); date = processClassOK(ThaiBuddhistDate.class); date = dateSupplier(); // date = processClassWeird(ThaiBuddhistDate.class); // does not compile (correct) }
Example 8
Source File: TestExampleCode.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@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); }
Example 9
Source File: TCKThaiBuddhistChronology.java From hottub with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="prolepticYear") public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) { assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear) ; assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear - YDIFF).isLeap()); ThaiBuddhistDate jdate = ThaiBuddhistDate.now(); jdate = jdate.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2); if (isLeapYear) { assertEquals(jdate.lengthOfMonth(), 29); } else { assertEquals(jdate.lengthOfMonth(), 28); } }
Example 10
Source File: TestChronoLocalDate.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void test_date_checkGenerics_genericsMethod_concreteType() { ThaiBuddhistChronology chrono = ThaiBuddhistChronology.INSTANCE; ThaiBuddhistDate date = chrono.dateNow(); date = ThaiBuddhistDate.now(); date = processOK(date); date = processClassOK(ThaiBuddhistDate.class); date = dateSupplier(); // date = processClassWeird(ThaiBuddhistDate.class); // does not compile (correct) }
Example 11
Source File: TestChronoLocalDate.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void test_date_checkGenerics_genericsMethod_concreteType() { ThaiBuddhistChronology chrono = ThaiBuddhistChronology.INSTANCE; ThaiBuddhistDate date = chrono.dateNow(); date = ThaiBuddhistDate.now(); date = processOK(date); date = processClassOK(ThaiBuddhistDate.class); date = dateSupplier(); // date = processClassWeird(ThaiBuddhistDate.class); // does not compile (correct) }
Example 12
Source File: TCKThaiBuddhistChronology.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="prolepticYear") public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) { assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear) ; assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear - YDIFF).isLeap()); ThaiBuddhistDate jdate = ThaiBuddhistDate.now(); jdate = jdate.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2); if (isLeapYear) { assertEquals(jdate.lengthOfMonth(), 29); } else { assertEquals(jdate.lengthOfMonth(), 28); } }
Example 13
Source File: TestChronoLocalDate.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void test_date_checkGenerics_genericsMethod_concreteType() { ThaiBuddhistChronology chrono = ThaiBuddhistChronology.INSTANCE; ThaiBuddhistDate date = chrono.dateNow(); date = ThaiBuddhistDate.now(); date = processOK(date); date = processClassOK(ThaiBuddhistDate.class); date = dateSupplier(); // date = processClassWeird(ThaiBuddhistDate.class); // does not compile (correct) }
Example 14
Source File: TestExampleCode.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@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); }
Example 15
Source File: TCKThaiBuddhistChronology.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider="prolepticYear") public void test_isLeapYear(int eraValue, Era era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) { assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear) ; assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear - YDIFF).isLeap()); ThaiBuddhistDate jdate = ThaiBuddhistDate.now(); jdate = jdate.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2); if (isLeapYear) { assertEquals(jdate.lengthOfMonth(), 29); } else { assertEquals(jdate.lengthOfMonth(), 28); } }
Example 16
Source File: TestChronoLocalDate.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void test_date_checkGenerics_genericsMethod_concreteType() { ThaiBuddhistChronology chrono = ThaiBuddhistChronology.INSTANCE; ThaiBuddhistDate date = chrono.dateNow(); date = ThaiBuddhistDate.now(); date = processOK(date); date = processClassOK(ThaiBuddhistDate.class); date = dateSupplier(); // date = processClassWeird(ThaiBuddhistDate.class); // does not compile (correct) }
Example 17
Source File: TestChronoLocalDate.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void test_date_checkGenerics_genericsMethod_concreteType() { ThaiBuddhistChronology chrono = ThaiBuddhistChronology.INSTANCE; ThaiBuddhistDate date = chrono.dateNow(); date = ThaiBuddhistDate.now(); date = processOK(date); date = processClassOK(ThaiBuddhistDate.class); date = dateSupplier(); // date = processClassWeird(ThaiBuddhistDate.class); // does not compile (correct) }
Example 18
Source File: TestExampleCode.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@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); }
Example 19
Source File: TestChronoLocalDate.java From hottub with GNU General Public License v2.0 | 5 votes |
public void test_date_checkGenerics_genericsMethod_concreteType() { ThaiBuddhistChronology chrono = ThaiBuddhistChronology.INSTANCE; ThaiBuddhistDate date = chrono.dateNow(); date = ThaiBuddhistDate.now(); date = processOK(date); date = processClassOK(ThaiBuddhistDate.class); date = dateSupplier(); // date = processClassWeird(ThaiBuddhistDate.class); // does not compile (correct) }
Example 20
Source File: TestExampleCode.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@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); }