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