Java Code Examples for java.time.chrono.ChronoLocalDateTime#toLocalDate()

The following examples show how to use java.time.chrono.ChronoLocalDateTime#toLocalDate() . 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: TCKMinguoChronology.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused")
@Test(dataProvider="samples")
public void test_MinguoDate(MinguoDate minguoDate, LocalDate iso) {
    MinguoDate hd = minguoDate;
    ChronoLocalDateTime<MinguoDate> hdt = hd.atTime(LocalTime.NOON);
    ZoneOffset zo = ZoneOffset.ofHours(1);
    ChronoZonedDateTime<MinguoDate> hzdt = hdt.atZone(zo);
    hdt = hdt.plus(1, ChronoUnit.YEARS);
    hdt = hdt.plus(1, ChronoUnit.MONTHS);
    hdt = hdt.plus(1, ChronoUnit.DAYS);
    hdt = hdt.plus(1, ChronoUnit.HOURS);
    hdt = hdt.plus(1, ChronoUnit.MINUTES);
    hdt = hdt.plus(1, ChronoUnit.SECONDS);
    hdt = hdt.plus(1, ChronoUnit.NANOS);
    ChronoLocalDateTime<MinguoDate> a2 = hzdt.toLocalDateTime();
    MinguoDate a3 = a2.toLocalDate();
    MinguoDate a5 = hzdt.toLocalDate();
    //System.out.printf(" d: %s, dt: %s; odt: %s; zodt: %s; a4: %s%n", date, hdt, hodt, hzdt, a5);
}
 
Example 2
Source File: TCKMinguoChronology.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused")
@Test(dataProvider="samples")
public void test_MinguoDate(MinguoDate minguoDate, LocalDate iso) {
    MinguoDate hd = minguoDate;
    ChronoLocalDateTime<MinguoDate> hdt = hd.atTime(LocalTime.NOON);
    ZoneOffset zo = ZoneOffset.ofHours(1);
    ChronoZonedDateTime<MinguoDate> hzdt = hdt.atZone(zo);
    hdt = hdt.plus(1, ChronoUnit.YEARS);
    hdt = hdt.plus(1, ChronoUnit.MONTHS);
    hdt = hdt.plus(1, ChronoUnit.DAYS);
    hdt = hdt.plus(1, ChronoUnit.HOURS);
    hdt = hdt.plus(1, ChronoUnit.MINUTES);
    hdt = hdt.plus(1, ChronoUnit.SECONDS);
    hdt = hdt.plus(1, ChronoUnit.NANOS);
    ChronoLocalDateTime<MinguoDate> a2 = hzdt.toLocalDateTime();
    MinguoDate a3 = a2.toLocalDate();
    MinguoDate a5 = hzdt.toLocalDate();
    //System.out.printf(" d: %s, dt: %s; odt: %s; zodt: %s; a4: %s%n", date, hdt, hodt, hzdt, a5);
}
 
Example 3
Source File: TCKMinguoChronology.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused")
@Test(dataProvider="samples")
public void test_MinguoDate(MinguoDate minguoDate, LocalDate iso) {
    MinguoDate hd = minguoDate;
    ChronoLocalDateTime<MinguoDate> hdt = hd.atTime(LocalTime.NOON);
    ZoneOffset zo = ZoneOffset.ofHours(1);
    ChronoZonedDateTime<MinguoDate> hzdt = hdt.atZone(zo);
    hdt = hdt.plus(1, ChronoUnit.YEARS);
    hdt = hdt.plus(1, ChronoUnit.MONTHS);
    hdt = hdt.plus(1, ChronoUnit.DAYS);
    hdt = hdt.plus(1, ChronoUnit.HOURS);
    hdt = hdt.plus(1, ChronoUnit.MINUTES);
    hdt = hdt.plus(1, ChronoUnit.SECONDS);
    hdt = hdt.plus(1, ChronoUnit.NANOS);
    ChronoLocalDateTime<MinguoDate> a2 = hzdt.toLocalDateTime();
    MinguoDate a3 = a2.toLocalDate();
    MinguoDate a5 = hzdt.toLocalDate();
    //System.out.printf(" d: %s, dt: %s; odt: %s; zodt: %s; a4: %s%n", date, hdt, hodt, hzdt, a5);
}
 
Example 4
Source File: TCKMinguoChronology.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused")
@Test(dataProvider="samples")
public void test_MinguoDate(MinguoDate minguoDate, LocalDate iso) {
    MinguoDate hd = minguoDate;
    ChronoLocalDateTime<MinguoDate> hdt = hd.atTime(LocalTime.NOON);
    ZoneOffset zo = ZoneOffset.ofHours(1);
    ChronoZonedDateTime<MinguoDate> hzdt = hdt.atZone(zo);
    hdt = hdt.plus(1, ChronoUnit.YEARS);
    hdt = hdt.plus(1, ChronoUnit.MONTHS);
    hdt = hdt.plus(1, ChronoUnit.DAYS);
    hdt = hdt.plus(1, ChronoUnit.HOURS);
    hdt = hdt.plus(1, ChronoUnit.MINUTES);
    hdt = hdt.plus(1, ChronoUnit.SECONDS);
    hdt = hdt.plus(1, ChronoUnit.NANOS);
    ChronoLocalDateTime<MinguoDate> a2 = hzdt.toLocalDateTime();
    MinguoDate a3 = a2.toLocalDate();
    MinguoDate a5 = hzdt.toLocalDate();
    //System.out.printf(" d: %s, dt: %s; odt: %s; zodt: %s; a4: %s%n", date, hdt, hodt, hzdt, a5);
}
 
Example 5
Source File: TestExampleCode.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example 6
Source File: TestExampleCode.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 7
Source File: TestExampleCode.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example 8
Source File: TestExampleCode.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example 9
Source File: TestExampleCode.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example 10
Source File: TestExampleCode.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 11
Source File: TestExampleCode.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 12
Source File: TestExampleCode.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example 13
Source File: TestExampleCode.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 14
Source File: TestExampleCode.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example 15
Source File: TestExampleCode.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
void test_unknownChronologyWithDateTime() {
    ChronoLocalDate date = LocalDate.now();
    ChronoLocalDateTime<?> cldt = date.atTime(LocalTime.NOON);
    ChronoLocalDate ld = cldt.toLocalDate();
    ChronoLocalDateTime<?> noonTomorrow = tomorrowNoon(ld);
}
 
Example 16
Source File: TestExampleCode.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
void test_unknownChronologyWithDateTime() {
    ChronoLocalDate date = LocalDate.now();
    ChronoLocalDateTime<?> cldt = date.atTime(LocalTime.NOON);
    ChronoLocalDate ld = cldt.toLocalDate();
    ChronoLocalDateTime<?> noonTomorrow = tomorrowNoon(ld);
}
 
Example 17
Source File: TestExampleCode.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
void test_unknownChronologyWithDateTime() {
    ChronoLocalDate date = LocalDate.now();
    ChronoLocalDateTime<?> cldt = date.atTime(LocalTime.NOON);
    ChronoLocalDate ld = cldt.toLocalDate();
    ChronoLocalDateTime<?> noonTomorrow = tomorrowNoon(ld);
}
 
Example 18
Source File: TestExampleCode.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
void test_unknownChronologyWithDateTime() {
    ChronoLocalDate date = LocalDate.now();
    ChronoLocalDateTime<?> cldt = date.atTime(LocalTime.NOON);
    ChronoLocalDate ld = cldt.toLocalDate();
    ChronoLocalDateTime<?> noonTomorrow = tomorrowNoon(ld);
}
 
Example 19
Source File: TestExampleCode.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
void test_unknownChronologyWithDateTime() {
    ChronoLocalDate date = LocalDate.now();
    ChronoLocalDateTime<?> cldt = date.atTime(LocalTime.NOON);
    ChronoLocalDate ld = cldt.toLocalDate();
    ChronoLocalDateTime<?> noonTomorrow = tomorrowNoon(ld);
}
 
Example 20
Source File: TestExampleCode.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
void test_unknownChronologyWithDateTime() {
    ChronoLocalDate date = LocalDate.now();
    ChronoLocalDateTime<?> cldt = date.atTime(LocalTime.NOON);
    ChronoLocalDate ld = cldt.toLocalDate();
    ChronoLocalDateTime<?> noonTomorrow = tomorrowNoon(ld);
}