/** * Constructs a new period with the specified start date and duration. * * @param start * the start date of the period * @param duration * the duration of the period */ public Period(final DateTime start, final TemporalAmount duration) { super(start, new DateTime(Date.from(start.toInstant().plus(duration)))); this.duration = new TemporalAmountAdapter(duration); normalise(); }
/** * Constructs a new period with the specified start date and duration. * * @param start * the start date of the period * @param duration * the duration of the period */ public Period(final DateTime start, final TemporalAmount duration) { super(start, new DateTime(Date.from(start.toInstant().plus(duration)))); this.duration = new TemporalAmountAdapter(duration); normalise(); }
private static DateTime parseEndDate(String value, boolean resolve) throws ParseException { DateTime end; try { end = new DateTime(value.substring(value.indexOf('/') + 1)); } catch (ParseException e) { if (resolve) { final TemporalAmount duration = parseDuration(value).getDuration(); end = new DateTime(Date.from(parseStartDate(value).toInstant().plus(duration))); } else { throw e; } } return end; }
private static DateTime parseEndDate(String value, boolean resolve) throws ParseException { DateTime end; try { end = new DateTime(value.substring(value.indexOf('/') + 1)); } catch (ParseException e) { if (resolve) { final TemporalAmount duration = parseDuration(value).getDuration(); end = new DateTime(Date.from(parseStartDate(value).toInstant().plus(duration))); } else { throw e; } } return end; }
startMinusDuration.setTime(Date.from(period.getStart().toInstant().minus(rDuration)).getTime());
startMinusDuration.setTime(Date.from(period.getStart().toInstant().minus(rDuration)).getTime());