Example usage for java.time LocalDate plusWeeks

List of usage examples for java.time LocalDate plusWeeks

Introduction

In this page you can find the example usage for java.time LocalDate plusWeeks.

Prototype

public LocalDate plusWeeks(long weeksToAdd) 

Source Link

Document

Returns a copy of this LocalDate with the specified number of weeks added.

Usage

From source file:Main.java

public static void main(String[] args) {
    LocalDate a = LocalDate.of(2014, 6, 30);
    LocalDate b = a.plusWeeks(100);
    System.out.println(b);//w  w w .ja  v  a 2 s.c  o m
}

From source file:Main.java

public static void main(String[] args) {
    LocalDate today = LocalDate.now();

    // plus and minus operations
    System.out.println("10 days after today will be " + today.plusDays(10));
    System.out.println("3 weeks after today will be " + today.plusWeeks(3));
    System.out.println("20 months after today will be " + today.plusMonths(20));

    System.out.println("10 days before today will be " + today.minusDays(10));
    System.out.println("3 weeks before today will be " + today.minusWeeks(3));
    System.out.println("20 months before today will be " + today.minusMonths(20));

}

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, 6, 21);
    LocalDate localDate1 = localDate.plusDays(5);
    System.out.println(localDate1);
    LocalDate localDate2 = localDate.plusMonths(3);
    System.out.println(localDate2);
    LocalDate localDate3 = localDate.plusWeeks(3);
    System.out.println(localDate3);
}

From source file:Main.java

public static LocalDate[] nextWeekDay(LocalDate date) {

    if (date == null) {
        date = LocalDate.now();//  w  ww . j  a v a 2 s  .com
    }

    return getWeekday(date.plusWeeks(1));
}

From source file:com.romeikat.datamessie.core.base.ui.page.StatisticsPage.java

private String getToDate(final LocalDate date) {
    LocalDate toDate;//w  ww.  ja  v a 2s . com
    final StatisticsInterval statisticsInterval = statisticsIntervalSelector.getModelObject();
    switch (statisticsInterval) {
    case DAY:
        toDate = date;
        break;
    case WEEK:
        toDate = date.plusWeeks(1).minusDays(1);
        break;
    case MONTH:
        toDate = date.plusMonths(1).minusDays(1);
        break;
    case YEAR:
        toDate = date.plusYears(1).minusDays(1);
        break;
    default:
        toDate = null;
    }
    return DocumentsFilterPanel.formatLocalDate(toDate);
}

From source file:ui.Analyze.java

private Component buatKeuangan(LocalDate l) throws SQLException {
    org.jfree.data.category.DefaultCategoryDataset data = new org.jfree.data.category.DefaultCategoryDataset();
    for (LocalDate l2 = l; l2.isBefore(l.plusWeeks(1)); l2 = l2.plusDays(1)) {
        data.addValue(getUntung(l2), "Untung", l2);
        data.addValue(getRugi(l2), "Rugi", l2);
    }/*from  w w w . ja v a 2s  . c  om*/
    return new org.jfree.chart.ChartPanel(ChartFactory.createBarChart("Untung Rugi", "Periode", "Nilai", data,
            PlotOrientation.VERTICAL, true, true, false));
}

From source file:ui.Analyze.java

private Component labane(LocalDate l) throws SQLException {
    org.jfree.data.category.DefaultCategoryDataset data = new org.jfree.data.category.DefaultCategoryDataset();
    for (LocalDate l2 = l; l2.isBefore(l.plusWeeks(1)); l2 = l2.plusDays(1)) {
        Number u = getUntung(l2), r = getRugi(l2);
        data.addValue(u.longValue() - r.longValue(), "Laba", l2);
    }//w  ww. j a  v  a 2s. c om
    return new org.jfree.chart.ChartPanel(ChartFactory.createLineChart("Laba Bersih", "Periode", "Nilai", data,
            PlotOrientation.VERTICAL, true, true, false));
}