for (LocalDate date = startDate; date.isBefore(endDate); date = date.plusDays(1)) { ... }
LocalDate start = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); LocalDate end = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); for (LocalDate date = start; date.isBefore(end); date = date.plusDays(1)) { // Do your job here with `date`. System.out.println(date); }
public LocalDate getCalendarDateStart() { LocalDate startDate = null; for (Service service : services.values()) { for (LocalDate date : service.calendar_dates.keySet()) { if (startDate == null || date.isBefore(startDate)) startDate = date; } } return startDate; }
boolean isBetweenInclusive(LocalDate start, LocalDate end, LocalDate target) { return !target.isBefore(start) && !target.isAfter(end); }
LocalDate date = LocalDate.of(2005, 1, 1); // Assign date to check if(date.isBefore(today.minusYears(10)) && date.isAfter(today.minusYears(20))) //Do Something
LocalDate now = new DateTime().toLocalDate(); LocalDate plus10days = now.plusDays(10); LocalDate event = new DateTime(year, month, day, 0, 0, 0, 0).toLocalDate(); if (!event.isBefore(now) && !event.isAfter(plus10days)) { // Event is between now and 10 days (inclusive). }
final LocalDate exd = parseDate(expiryDate); if(exd.isBefore(today)) { valid = false; msgs.add("License is expired");
return; if (telemetry.getEnd().isBefore(LocalDate.now())) { LOGGER.config("Skipping telemetry for '" + telemetry.getId() + "' as it is configured to end in the past"); return;
/** * Verifies that the actual {@code LocalDate} is <b>strictly</b> before the given one. * <p> * Example : * <pre><code class='java'> assertThat(parse("2000-01-01")).isBefore(parse("2000-01-02"));</code></pre> * * @param other the given {@link LocalDate}. * @return this assertion object. * @throws AssertionError if the actual {@code LocalDate} is {@code null}. * @throws IllegalArgumentException if other {@code LocalDate} is {@code null}. * @throws AssertionError if the actual {@code LocalDate} is not strictly before the given one. */ public SELF isBefore(LocalDate other) { Objects.instance().assertNotNull(info, actual); assertLocalDateParameterIsNotNull(other); if (!actual.isBefore(other)) throw Failures.instance().failure(info, shouldBeBefore(actual, other)); return myself; }
/** * Verifies that the actual {@code LocalDate} is after or equals to the given one. * <p> * Example : * <pre><code class='java'> assertThat(parse("2000-01-01")).isAfterOrEqualTo(parse("2000-01-01")) * .isAfterOrEqualTo(parse("1999-12-31"));</code></pre> * * @param other the given {@link LocalDate}. * @return this assertion object. * @throws AssertionError if the actual {@code LocalDate} is {@code null}. * @throws IllegalArgumentException if other {@code LocalDate} is {@code null}. * @throws AssertionError if the actual {@code LocalDate} is not after or equals to the given one. */ public SELF isAfterOrEqualTo(LocalDate other) { Objects.instance().assertNotNull(info, actual); assertLocalDateParameterIsNotNull(other); if (actual.isBefore(other)) { throw Failures.instance().failure(info, shouldBeAfterOrEqualsTo(actual, other)); } return myself; }
/** * Verifies that the actual {@code LocalDate} is <b>strictly</b> before the given one. * <p> * Example : * <pre><code class='java'> assertThat(parse("2000-01-01")).isBefore(parse("2000-01-02"));</code></pre> * * @param other the given {@link LocalDate}. * @return this assertion object. * @throws AssertionError if the actual {@code LocalDate} is {@code null}. * @throws IllegalArgumentException if other {@code LocalDate} is {@code null}. * @throws AssertionError if the actual {@code LocalDate} is not strictly before the given one. */ public SELF isBefore(LocalDate other) { Objects.instance().assertNotNull(info, actual); assertLocalDateParameterIsNotNull(other); if (!actual.isBefore(other)) throw Failures.instance().failure(info, shouldBeBefore(actual, other)); return myself; }
/** * Verifies that the actual {@code LocalDate} is after or equals to the given one. * <p> * Example : * <pre><code class='java'> assertThat(parse("2000-01-01")).isAfterOrEqualTo(parse("2000-01-01")) * .isAfterOrEqualTo(parse("1999-12-31"));</code></pre> * * @param other the given {@link LocalDate}. * @return this assertion object. * @throws AssertionError if the actual {@code LocalDate} is {@code null}. * @throws IllegalArgumentException if other {@code LocalDate} is {@code null}. * @throws AssertionError if the actual {@code LocalDate} is not after or equals to the given one. */ public SELF isAfterOrEqualTo(LocalDate other) { Objects.instance().assertNotNull(info, actual); assertLocalDateParameterIsNotNull(other); if (actual.isBefore(other)) { throw Failures.instance().failure(info, shouldBeAfterOrEqualsTo(actual, other)); } return myself; }
LocalDate localDate1 = formatter.parseLocalDate( string1 ); LocalDate localDate2 = formatter.parseLocalDate( string2 ); LocalDate localDate3 = formatter.parseLocalDate( string3 ); boolean is1After2 = localDate1.isAfter( localDate2 ); boolean is2Before3 = localDate2.isBefore( localDate3 );
LocalDate startDate = new LocalDate(2011, 11, 8); LocalDate endDate = new LocalDate(2012, 5, 1); LocalDate thisMonday = startDate.withDayOfWeek(DateTimeConstants.MONDAY); if (startDate.isAfter(thisMonday)) { startDate = thisMonday.plusWeeks(1); // start on next monday } else { startDate = thisMonday; // start on this monday } while (startDate.isBefore(endDate)) { System.out.println(startDate); startDate = startDate.plusWeeks(1); }
double forecastValuePeriodsInternal(ResolvedSwapLeg leg, RatesProvider provider) { double total = 0d; for (SwapPaymentPeriod period : leg.getPaymentPeriods()) { if (!period.getPaymentDate().isBefore(provider.getValuationDate())) { total += paymentPeriodPricer.forecastValue(period, provider); } } return total; }
PointSensitivityBuilder presentValueSensitivityPeriodsInternal(ResolvedSwapLeg leg, RatesProvider provider) { PointSensitivityBuilder builder = PointSensitivityBuilder.none(); for (SwapPaymentPeriod period : leg.getPaymentPeriods()) { if (!period.getPaymentDate().isBefore(provider.getValuationDate())) { builder = builder.combinedWith(paymentPeriodPricer.presentValueSensitivity(period, provider)); } } return builder; }
@Override public PointSensitivityBuilder ratePointSensitivity(IborIndexObservation observation) { LocalDate fixingDate = observation.getFixingDate(); LocalDate valuationDate = getValuationDate(); if (fixingDate.isBefore(valuationDate) || (fixingDate.equals(valuationDate) && fixings.get(fixingDate).isPresent())) { return PointSensitivityBuilder.none(); } return IborRateSensitivity.of(observation, 1d); }
@Override public PointSensitivityBuilder ratePointSensitivity(IborIndexObservation observation) { LocalDate fixingDate = observation.getFixingDate(); LocalDate valuationDate = getValuationDate(); if (fixingDate.isBefore(valuationDate) || (fixingDate.equals(valuationDate) && fixings.get(fixingDate).isPresent())) { return PointSensitivityBuilder.none(); } return IborRateSensitivity.of(observation, 1d); }
@Override public PointSensitivityBuilder ratePointSensitivity(OvernightIndexObservation observation) { LocalDate valuationDate = getValuationDate(); LocalDate fixingDate = observation.getFixingDate(); LocalDate publicationDate = observation.getPublicationDate(); if (publicationDate.isBefore(valuationDate) || (publicationDate.equals(valuationDate) && fixings.get(fixingDate).isPresent())) { return PointSensitivityBuilder.none(); } return OvernightRateSensitivity.of(observation, 1d); }
@Override public PointSensitivityBuilder ratePointSensitivity(FxIndexObservation observation, Currency baseCurrency) { ArgChecker.isTrue( index.getCurrencyPair().contains(baseCurrency), "Currency {} invalid for FxIndex {}", baseCurrency, index); LocalDate fixingDate = observation.getFixingDate(); if (fixingDate.isBefore(getValuationDate()) || (fixingDate.equals(getValuationDate()) && fixings.get(fixingDate).isPresent())) { return PointSensitivityBuilder.none(); } return FxIndexSensitivity.of(observation, baseCurrency, 1d); }