Java Code Examples for java.time.LocalTime#minusHours()
The following examples show how to use
java.time.LocalTime#minusHours() .
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: TCKLocalDateTime.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Test public void test_minusHours_fromOne() { LocalDateTime base = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(1, 0)); LocalDate d = base.toLocalDate().plusDays(2); LocalTime t = LocalTime.of(4, 0); for (int i = -50; i < 50; i++) { LocalDateTime dt = base.minusHours(i); t = t.minusHours(1); if (t.getHour() == 23) { d = d.minusDays(1); } assertEquals(dt.toLocalDate(), d, String.valueOf(i)); assertEquals(dt.toLocalTime(), t); } }
Example 2
Source File: TCKLocalDateTime.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Test public void test_minusHours_fromOne() { LocalDateTime base = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(1, 0)); LocalDate d = base.toLocalDate().plusDays(2); LocalTime t = LocalTime.of(4, 0); for (int i = -50; i < 50; i++) { LocalDateTime dt = base.minusHours(i); t = t.minusHours(1); if (t.getHour() == 23) { d = d.minusDays(1); } assertEquals(dt.toLocalDate(), d, String.valueOf(i)); assertEquals(dt.toLocalTime(), t); } }
Example 3
Source File: TCKLocalDateTime.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Test public void test_minusHours_fromZero() { LocalDateTime base = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.MIDNIGHT); LocalDate d = base.toLocalDate().plusDays(2); LocalTime t = LocalTime.of(3, 0); for (int i = -50; i < 50; i++) { LocalDateTime dt = base.minusHours(i); t = t.minusHours(1); if (t.getHour() == 23) { d = d.minusDays(1); } assertEquals(dt.toLocalDate(), d, String.valueOf(i)); assertEquals(dt.toLocalTime(), t); } }
Example 4
Source File: TCKLocalDateTime.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Test public void test_minusHours_fromOne() { LocalDateTime base = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(1, 0)); LocalDate d = base.toLocalDate().plusDays(2); LocalTime t = LocalTime.of(4, 0); for (int i = -50; i < 50; i++) { LocalDateTime dt = base.minusHours(i); t = t.minusHours(1); if (t.getHour() == 23) { d = d.minusDays(1); } assertEquals(dt.toLocalDate(), d, String.valueOf(i)); assertEquals(dt.toLocalTime(), t); } }
Example 5
Source File: TCKLocalDateTime.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Test public void test_minusHours_fromOne() { LocalDateTime base = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(1, 0)); LocalDate d = base.toLocalDate().plusDays(2); LocalTime t = LocalTime.of(4, 0); for (int i = -50; i < 50; i++) { LocalDateTime dt = base.minusHours(i); t = t.minusHours(1); if (t.getHour() == 23) { d = d.minusDays(1); } assertEquals(dt.toLocalDate(), d, String.valueOf(i)); assertEquals(dt.toLocalTime(), t); } }
Example 6
Source File: TCKLocalDateTime.java From j2objc with Apache License 2.0 | 6 votes |
@Test public void test_minusHours_fromZero() { LocalDateTime base = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.MIDNIGHT); LocalDate d = base.toLocalDate().plusDays(2); LocalTime t = LocalTime.of(3, 0); for (int i = -50; i < 50; i++) { LocalDateTime dt = base.minusHours(i); t = t.minusHours(1); if (t.getHour() == 23) { d = d.minusDays(1); } assertEquals(String.valueOf(i), dt.toLocalDate(), d); assertEquals(dt.toLocalTime(), t); } }
Example 7
Source File: TCKLocalDateTime.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Test public void test_minusHours_fromOne() { LocalDateTime base = TEST_2007_07_15_12_30_40_987654321.with(LocalTime.of(1, 0)); LocalDate d = base.toLocalDate().plusDays(2); LocalTime t = LocalTime.of(4, 0); for (int i = -50; i < 50; i++) { LocalDateTime dt = base.minusHours(i); t = t.minusHours(1); if (t.getHour() == 23) { d = d.minusDays(1); } assertEquals(dt.toLocalDate(), d, String.valueOf(i)); assertEquals(dt.toLocalTime(), t); } }
Example 8
Source File: TCKLocalTime.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusHours_fromOne() { LocalTime base = LocalTime.of(1, 0); for (int i = -50; i < 50; i++) { LocalTime t = base.minusHours(i); assertEquals(t.getHour(), (1 + (-i % 24) + 24) % 24); } }
Example 9
Source File: TCKLocalTime.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusHours_fromOne() { LocalTime base = LocalTime.of(1, 0); for (int i = -50; i < 50; i++) { LocalTime t = base.minusHours(i); assertEquals(t.getHour(), (1 + (-i % 24) + 24) % 24); } }
Example 10
Source File: TCKLocalTime.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusHours_one() { LocalTime t = LocalTime.MIDNIGHT; for (int i = 0; i < 50; i++) { t = t.minusHours(1); assertEquals(t.getHour(), (((-i + 23) % 24) + 24) % 24, String.valueOf(i)); } }
Example 11
Source File: TCKLocalTime.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusHours_fromOne() { LocalTime base = LocalTime.of(1, 0); for (int i = -50; i < 50; i++) { LocalTime t = base.minusHours(i); assertEquals(t.getHour(), (1 + (-i % 24) + 24) % 24); } }
Example 12
Source File: TCKLocalTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusHours_fromOne() { LocalTime base = LocalTime.of(1, 0); for (int i = -50; i < 50; i++) { LocalTime t = base.minusHours(i); assertEquals(t.getHour(), (1 + (-i % 24) + 24) % 24); } }
Example 13
Source File: TCKLocalTime.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusHours_fromZero() { LocalTime base = LocalTime.MIDNIGHT; for (int i = -50; i < 50; i++) { LocalTime t = base.minusHours(i); assertEquals(t.getHour(), ((-i % 24) + 24) % 24); } }
Example 14
Source File: TCKLocalTime.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusHours_fromOne() { LocalTime base = LocalTime.of(1, 0); for (int i = -50; i < 50; i++) { LocalTime t = base.minusHours(i); assertEquals(t.getHour(), (1 + (-i % 24) + 24) % 24); } }
Example 15
Source File: TCKLocalTime.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusHours_fromZero() { LocalTime base = LocalTime.MIDNIGHT; for (int i = -50; i < 50; i++) { LocalTime t = base.minusHours(i); assertEquals(t.getHour(), ((-i % 24) + 24) % 24); } }
Example 16
Source File: TCKLocalTime.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusHours_fromOne() { LocalTime base = LocalTime.of(1, 0); for (int i = -50; i < 50; i++) { LocalTime t = base.minusHours(i); assertEquals(t.getHour(), (1 + (-i % 24) + 24) % 24); } }
Example 17
Source File: TCKLocalTime.java From j2objc with Apache License 2.0 | 5 votes |
@Test public void test_minusHours_fromZero() { LocalTime base = LocalTime.MIDNIGHT; for (int i = -50; i < 50; i++) { LocalTime t = base.minusHours(i); assertEquals(t.getHour(), ((-i % 24) + 24) % 24); } }
Example 18
Source File: TCKLocalTime.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusHours_one() { LocalTime t = LocalTime.MIDNIGHT; for (int i = 0; i < 50; i++) { t = t.minusHours(1); assertEquals(t.getHour(), (((-i + 23) % 24) + 24) % 24, String.valueOf(i)); } }
Example 19
Source File: TCKLocalTime.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusHours_fromZero() { LocalTime base = LocalTime.MIDNIGHT; for (int i = -50; i < 50; i++) { LocalTime t = base.minusHours(i); assertEquals(t.getHour(), ((-i % 24) + 24) % 24); } }
Example 20
Source File: TCKLocalTime.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusHours_fromOne() { LocalTime base = LocalTime.of(1, 0); for (int i = -50; i < 50; i++) { LocalTime t = base.minusHours(i); assertEquals(t.getHour(), (1 + (-i % 24) + 24) % 24); } }