Get the current date.
Get yesterday's date.
LocalDate y = LocalDate.now().minusDays(1);
Get tomorrow's date
LocalDate t = LocalDate.now().plusDays(1);
Get a specific date.
LocalDate t = LocalDate.of(1974, 6, 2, 8, 30, 0, 0);
In addition to the
minus methods, there are a set of "with" methods that can be used to set a particular field on a
The example above returns a new instance with the month set to June (this differs from
setMonth was indexed a 0 making June 5).
Because LocalDate manipulations return immutable LocalDate instances, these methods may also be chained together.
LocalDate ld = LocalDate.now().plusDays(1).plusYears(1);
This would give us tomorrow's date one year from now.