fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.time.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. LocalDate dateOne=LocalDate.ofYearDay(2019, 60);
  14. LocalDate dateTwo=LocalDate.ofYearDay(2019, 32);
  15. LocalDate startDate=dateOne.minusDays(1);
  16. System.out.println(dateOne);
  17. System.out.println(dateTwo);
  18. System.out.println("after change");
  19. System.out.println(startDate);
  20. System.out.println("plus month");
  21. for(int i=0;i<12;i++){
  22. System.out.println("loopedStartDate"+startDate.plusMonths(i));
  23. //System.out.println("loopedEndDate"+startDate.plusMonths(i+1));
  24. }
  25. }
  26. }
Success #stdin #stdout 0.13s 2184192KB
stdin
Standard input is empty
stdout
2019-03-01
2019-02-01
after change
2019-02-28
plus month
loopedStartDate2019-02-28
loopedStartDate2019-03-28
loopedStartDate2019-04-28
loopedStartDate2019-05-28
loopedStartDate2019-06-28
loopedStartDate2019-07-28
loopedStartDate2019-08-28
loopedStartDate2019-09-28
loopedStartDate2019-10-28
loopedStartDate2019-11-28
loopedStartDate2019-12-28
loopedStartDate2020-01-28