Java has a built-in date library, java.time bundled with Java 8.
The following code shows how to use the
import java.time.LocalDate; public class Foo { public static void main(String[] args) { System.out.println(LocalDate.parse("2014-05-03").minusWeeks(2)); } }minusWeeks
to get the date in two weeks before.