Java Language Dates and Time (java.time.*) Simple Date Manipulations


Get the current date.

Get yesterday's date.

LocalDate y =;

Get tomorrow's date

LocalDate t =;

Get a specific date.

LocalDate t = LocalDate.of(1974, 6, 2, 8, 30, 0, 0);

In addition to the plus and minus methods, there are a set of "with" methods that can be used to set a particular field on a LocalDate instance.;

The example above returns a new instance with the month set to June (this differs from java.util.Date where setMonth was indexed a 0 making June 5).

Because LocalDate manipulations return immutable LocalDate instances, these methods may also be chained together.

LocalDate ld =;

This would give us tomorrow's date one year from now.