Create today, tomorrow and yesterday date
Description
The following code shows how to create today, tomorrow and yesterday date.
Example
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
/* w w w . j a v a 2 s .co m*/
public class Main {
public static void main(String... args) {
LocalDate today = LocalDate.now();
LocalDate tomorrow = today.plus(1, ChronoUnit.DAYS);
LocalDate yesterday = tomorrow.minusDays(2);
System.out.println(today);
System.out.println(tomorrow);
System.out.println(yesterday);
}
}
The code above generates the following result.