Java Code Examples for java.time.ZonedDateTime#minusMinutes()
The following examples show how to use
java.time.ZonedDateTime#minusMinutes() .
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: DateTimeWithinPeriodTest.java From rya with Apache License 2.0 | 6 votes |
@Test public void testMinutes() throws DatatypeConfigurationException, ValueExprEvaluationException { DatatypeFactory dtf = DatatypeFactory.newInstance(); ZonedDateTime zTime = testThisTimeDate; String time = zTime.format(DateTimeFormatter.ISO_INSTANT); ZonedDateTime zTime1 = zTime.minusMinutes(1); String time1 = zTime1.format(DateTimeFormatter.ISO_INSTANT); Literal now = VF.createLiteral(dtf.newXMLGregorianCalendar(time)); Literal nowMinusOne = VF.createLiteral(dtf.newXMLGregorianCalendar(time1)); DateTimeWithinPeriod func = new DateTimeWithinPeriod(); assertEquals(TRUE, func.evaluate(VF, now, now,VF.createLiteral(1),OWLTime.MINUTES_URI)); assertEquals(FALSE, func.evaluate(VF, now, nowMinusOne,VF.createLiteral(1),OWLTime.MINUTES_URI)); assertEquals(TRUE, func.evaluate(VF, now, nowMinusOne,VF.createLiteral(2),OWLTime.MINUTES_URI)); }
Example 2
Source File: TCKZonedDateTime.java From hottub with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 3
Source File: TimeIterator.java From incubator-gobblin with Apache License 2.0 | 5 votes |
/** * Decrease the given time by {@code units}, which must be positive, of {@code granularity} */ public static ZonedDateTime dec(ZonedDateTime time, Granularity granularity, long units) { switch (granularity) { case MINUTE: return time.minusMinutes(units); case HOUR: return time.minusHours(units); case DAY: return time.minusDays(units); case MONTH: return time.minusMonths(units); } throw new RuntimeException("Unsupported granularity: " + granularity); }
Example 4
Source File: TCKZonedDateTime.java From j2objc with Apache License 2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 5
Source File: TCKZonedDateTime.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 6
Source File: TCKZonedDateTime.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 7
Source File: TCKZonedDateTime.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 8
Source File: TCKZonedDateTime.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 9
Source File: TCKZonedDateTime.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 10
Source File: TCKZonedDateTime.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 11
Source File: TCKZonedDateTime.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 12
Source File: TCKZonedDateTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 13
Source File: TCKZonedDateTime.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 14
Source File: BlackDuckAccumulatorTest.java From blackduck-alert with Apache License 2.0 | 5 votes |
@Test public void testCreateDateRange() { BlackDuckAccumulator notificationAccumulator = createNonProcessingAccumulator(testBlackDuckProperties); DateRange dateRange = notificationAccumulator.createDateRange(); assertNotNull(dateRange); ZonedDateTime startTime = ZonedDateTime.ofInstant(dateRange.getStart().toInstant(), ZoneOffset.UTC); ZonedDateTime endTime = ZonedDateTime.ofInstant(dateRange.getEnd().toInstant(), ZoneOffset.UTC); assertNotEquals(dateRange.getStart(), dateRange.getEnd()); ZonedDateTime expectedStartTime = endTime.minusMinutes(1); assertEquals(expectedStartTime, startTime); }
Example 15
Source File: TCKZonedDateTime.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 16
Source File: TCKZonedDateTime.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 17
Source File: TCKZonedDateTime.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Test public void test_minusMinutes_minutes() { LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0); ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100); ZonedDateTime test = base.minusMinutes(30); assertEquals(test, ZonedDateTime.of(ldt.minusMinutes(30), ZONE_0100)); }
Example 18
Source File: SystemActionsTest.java From blackduck-alert with Apache License 2.0 | 4 votes |
private List<SystemMessageModel> createSystemMessageList() { ZonedDateTime zonedDateTime = ZonedDateTime.now(); zonedDateTime = zonedDateTime.minusMinutes(1); return List.of(new SystemMessageModel("1", RestConstants.formatDate(Date.from(zonedDateTime.toInstant())), "type", "content", "type")); }
Example 19
Source File: CreateDeletePeriodicPCJ.java From rya with Apache License 2.0 | 4 votes |
@Test public void deletePeriodicPCJ() throws Exception { String query = "prefix function: <http://org.apache.rya/function#> " // n + "prefix time: <http://www.w3.org/2006/time#> " // n + "select (count(?obs) as ?total) where {" // n + "Filter(function:periodic(?time, 2, .5, time:hours)) " // n + "?obs <uri:hasTime> ?time. " // n + "?obs <uri:hasId> ?id }"; // n // Create the Statements that will be loaded into Rya. final ValueFactory vf = SimpleValueFactory.getInstance(); final DatatypeFactory dtf = DatatypeFactory.newInstance(); ZonedDateTime time = ZonedDateTime.now(); ZonedDateTime zTime1 = time.minusMinutes(30); String time1 = zTime1.format(DateTimeFormatter.ISO_INSTANT); ZonedDateTime zTime2 = zTime1.minusMinutes(30); String time2 = zTime2.format(DateTimeFormatter.ISO_INSTANT); ZonedDateTime zTime3 = zTime2.minusMinutes(30); String time3 = zTime3.format(DateTimeFormatter.ISO_INSTANT); ZonedDateTime zTime4 = zTime3.minusMinutes(30); String time4 = zTime4.format(DateTimeFormatter.ISO_INSTANT); final Collection<Statement> statements = Sets.newHashSet( vf.createStatement(vf.createIRI("urn:obs_1"), vf.createIRI("uri:hasTime"), vf.createLiteral(dtf.newXMLGregorianCalendar(time1))), vf.createStatement(vf.createIRI("urn:obs_1"), vf.createIRI("uri:hasId"), vf.createLiteral("id_1")), vf.createStatement(vf.createIRI("urn:obs_2"), vf.createIRI("uri:hasTime"), vf.createLiteral(dtf.newXMLGregorianCalendar(time2))), vf.createStatement(vf.createIRI("urn:obs_2"), vf.createIRI("uri:hasId"), vf.createLiteral("id_2")), vf.createStatement(vf.createIRI("urn:obs_3"), vf.createIRI("uri:hasTime"), vf.createLiteral(dtf.newXMLGregorianCalendar(time3))), vf.createStatement(vf.createIRI("urn:obs_3"), vf.createIRI("uri:hasId"), vf.createLiteral("id_3")), vf.createStatement(vf.createIRI("urn:obs_4"), vf.createIRI("uri:hasTime"), vf.createLiteral(dtf.newXMLGregorianCalendar(time4))), vf.createStatement(vf.createIRI("urn:obs_4"), vf.createIRI("uri:hasId"), vf.createLiteral("id_4"))); runTest(query, statements, 30); }