Java Date Time Java Java API
java.time.LocalDate
public LocalDate minusWeeks(long weeksToSubtract)
This method subtracts the specified amount of weeks from the days field (adjusting other fields if necessary)
package com.logicbig.example.localdate;import java.time.LocalDate;import java.time.Month;public class MinusWeeksExample { public static void main (String... args) { LocalDate d = LocalDate.of(2016, Month.FEBRUARY, 29); LocalDate localDate = d.minusWeeks(200); System.out.println(localDate); }}
2012-04-30
package com.logicbig.example.localdate;import java.time.LocalDate;import java.time.Month;public class MinusWeeksExample2 { public static void main (String... args) { LocalDate d = LocalDate.of(2016, Month.MARCH, 1); LocalDate localDate = d.minusWeeks(2); System.out.println(localDate); }}
2016-02-16