Java Code Examples for org.threeten.bp.ZonedDateTime#plusMonths()
The following examples show how to use
org.threeten.bp.ZonedDateTime#plusMonths() .
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: TestStandardZoneRules.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void test_Dublin_getStandardOffset() { ZoneRules test = europeDublin(); ZonedDateTime zdt = createZDT(1840, 1, 1, ZoneOffset.UTC); while (zdt.getYear() < 2010) { Instant instant = zdt.toInstant(); if (zdt.getYear() < 1881) { assertEquals(test.getStandardOffset(instant), ZoneOffset.ofHoursMinutes(0, -25)); } else if (zdt.getYear() >= 1881 && zdt.getYear() < 1917) { assertEquals(test.getStandardOffset(instant), ZoneOffset.ofHoursMinutesSeconds(0, -25, -21)); } else if (zdt.getYear() >= 1917 && zdt.getYear() < 1969) { assertEquals(test.getStandardOffset(instant), OFFSET_ZERO, zdt.toString()); } else if (zdt.getYear() >= 1969 && zdt.getYear() < 1972) { // from 1968-02-18 to 1971-10-31, permanent UTC+1 assertEquals(test.getStandardOffset(instant), OFFSET_PONE); assertEquals(test.getOffset(instant), OFFSET_PONE, zdt.toString()); } else { assertEquals(test.getStandardOffset(instant), OFFSET_ZERO, zdt.toString()); assertEquals(test.getOffset(instant), zdt.getMonth() == Month.JANUARY ? OFFSET_ZERO : OFFSET_PONE, zdt.toString()); } zdt = zdt.plusMonths(6); } }
Example 2
Source File: TestStandardZoneRules.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void test_Paris_getStandardOffset() { ZoneRules test = europeParis(); ZonedDateTime zdt = createZDT(1840, 1, 1, ZoneOffset.UTC); while (zdt.getYear() < 2010) { Instant instant = zdt.toInstant(); if (zdt.toLocalDate().isBefore(LocalDate.of(1911, 3, 11))) { assertEquals(test.getStandardOffset(instant), ZoneOffset.ofHoursMinutesSeconds(0, 9, 21)); } else if (zdt.toLocalDate().isBefore(LocalDate.of(1940, 6, 14))) { assertEquals(test.getStandardOffset(instant), OFFSET_ZERO); } else if (zdt.toLocalDate().isBefore(LocalDate.of(1944, 8, 25))) { assertEquals(test.getStandardOffset(instant), OFFSET_PONE); } else if (zdt.toLocalDate().isBefore(LocalDate.of(1945, 9, 16))) { assertEquals(test.getStandardOffset(instant), OFFSET_ZERO); } else { assertEquals(test.getStandardOffset(instant), OFFSET_PONE); } zdt = zdt.plusMonths(6); } }
Example 3
Source File: TestStandardZoneRules.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void test_London_getStandardOffset() { ZoneRules test = europeLondon(); ZonedDateTime zdt = createZDT(1840, 1, 1, ZoneOffset.UTC); while (zdt.getYear() < 2010) { Instant instant = zdt.toInstant(); if (zdt.getYear() < 1848) { assertEquals(test.getStandardOffset(instant), ZoneOffset.ofHoursMinutesSeconds(0, -1, -15)); } else if (zdt.getYear() >= 1969 && zdt.getYear() < 1972) { assertEquals(test.getStandardOffset(instant), OFFSET_PONE); } else { assertEquals(test.getStandardOffset(instant), OFFSET_ZERO); } zdt = zdt.plusMonths(6); } }
Example 4
Source File: TestStandardZoneRules.java From threetenbp with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void test_NewYork_getStandardOffset() { ZoneRules test = americaNewYork(); ZonedDateTime dateTime = createZDT(1860, 1, 1, ZoneOffset.UTC); while (dateTime.getYear() < 2010) { Instant instant = dateTime.toInstant(); if (dateTime.toLocalDate().isBefore(LocalDate.of(1883, 11, 18))) { assertEquals(test.getStandardOffset(instant), ZoneOffset.of("-04:56:02")); } else { assertEquals(test.getStandardOffset(instant), ZoneOffset.ofHours(-5)); } dateTime = dateTime.plusMonths(6); } }