jodatime LocalDate (dealing with dates) Basic LocalDates

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

A given year-month-day:

LocalDate oneJanuaryNineteenSixty = new LocalDate(1960,1,1);

Today's date:

LocalDate today = LocalDate.now()

Tomorrow:

LocalDate tomorrow = LocalDate.now().plusDays(1);

Yesterday:

LocalDate yesterday = LocalDate.now().minusDays(1);

Two weeks ago:

LocalDate twoWeeksAgo = LocalDate.now().minusWeeks(2);

Nine months before 1960-01-01:

LocalDate conception = new LocalDate(1960-01-01).minusMonths(9);

The Saturday of this week:

LocalDate saturday = LocalDate.now().withDayOfWeek(DateTimeConstants.SATURDAY);


Got any jodatime Question?