Tutorial by Examples

A LocalDate is a date without a timezone. Consider using them when you are only concerned with the year, month, and day of month and are not interested in an exact time. For example, when we write our date of birth (such as 1960-01-01) we don't care about the timezone in which it happened.
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 tw...
Converting a java.util.Calendar object: Calendar rightNow = Calendar.getInstance(); LocalDate today = LocalDate.fromCalendarFields(rightNow); Converting a java.util.Date object: Date rightNow = new Date(); LocalDate today = LocalDate.fromDateFields(rightNow); Converting a string: String d...

Page 1 of 1