List of usage examples for org.joda.time MutableDateTime addDays
public void addDays(final int days)
From source file:com.tmathmeyer.sentinel.ui.views.year.YearCalendar.java
License:Open Source License
@Override public void updateDisplayable(Displayable event, boolean added) { Interval ival = event.getInterval(); MutableDateTime start = new MutableDateTime(ival.getStart()); while (start.isBefore(ival.getEnd())) { if (!added) { int day = start.getDayOfYear(); Integer ec = this.events.get(day); int eventCount = (ec == null || ec <= 0) ? 0 : ec - 1; this.events.put(day, eventCount); } else {//from ww w.j a v a2s . co m int day = start.getDayOfYear(); Integer ec = this.events.get(day); int eventCount = (ec == null) ? 1 : ec + 1; this.events.put(day, eventCount); } start.addDays(1); } }
From source file:com.tmathmeyer.sentinel.utils.Months.java
License:Open Source License
public static DateTime nextDay(DateTime time) { MutableDateTime mdt = new MutableDateTime(time); mdt.addDays(1); return mdt.toDateTime(); }
From source file:com.tmathmeyer.sentinel.utils.Months.java
License:Open Source License
public static DateTime prevDay(DateTime time) { MutableDateTime mdt = new MutableDateTime(time); mdt.addDays(-1); return mdt.toDateTime(); }
From source file:com.tmathmeyer.sentinel.utils.Months.java
License:Open Source License
public static DateTime nextWeek(DateTime time) { MutableDateTime mdt = new MutableDateTime(time); mdt.addDays(7); return mdt.toDateTime(); }
From source file:com.tmathmeyer.sentinel.utils.Months.java
License:Open Source License
public static DateTime prevWeek(DateTime time) { MutableDateTime mdt = new MutableDateTime(time); mdt.addDays(-7); return mdt.toDateTime(); }
From source file:com.tmathmeyer.sentinel.utils.Months.java
License:Open Source License
/** * /*from www . ja v a 2s . c om*/ * @param d any DateTime * @return get's the Sundae of the provided day's week */ public static DateTime getWeekStart(DateTime d) { MutableDateTime t = new MutableDateTime(d); t.addDays(-(d.getDayOfWeek() % 7)); return t.toDateTime(); }
From source file:com.xpn.xwiki.criteria.impl.PeriodFactory.java
License:Open Source License
private static MutableDateTime toDayEnd(MutableDateTime mdt) { mdt.addDays(1); return toDayStart(mdt); }
From source file:controllers.api.DashboardsApiController.java
License:Open Source License
private void nextStep(String interval, MutableDateTime currentTime) { switch (interval) { case "minute": currentTime.addMinutes(1);//from w w w . j ava2s. c om break; case "hour": currentTime.addHours(1); break; case "day": currentTime.addDays(1); break; case "week": currentTime.addWeeks(1); break; case "month": currentTime.addMonths(1); break; case "quarter": currentTime.addMonths(3); break; case "year": currentTime.addYears(1); break; default: throw new IllegalArgumentException("Invalid duration specified: " + interval); } }
From source file:ddf.metrics.reporting.internal.rrd4j.RrdMetricsRetriever.java
License:Open Source License
private void increment(MutableDateTime chunkStart, SUMMARY_INTERVALS summaryInterval) { switch (summaryInterval) { case minute:// w ww. j av a2 s.co m chunkStart.addMinutes(1); break; case hour: chunkStart.addHours(1); break; case day: chunkStart.addDays(1); break; case week: chunkStart.addWeeks(1); break; case month: chunkStart.addMonths(1); break; } }
From source file:de.pro.dbw.util.impl.DateConverter.java
License:Open Source License
public Long addDays(int days) { final MutableDateTime mdtNow = MutableDateTime.now(); mdtNow.addDays(days); return mdtNow.getMillis(); }