About
javase/9/docs/api/java/time/LocalDate.html - A date in the ISO-8601 calendar system, such as 2007-12-03
Articles Related
Management
Init
in the default time zone
LocalDate localDate = LocalDate.of(year,month,day);
LocalDate localDate = LocalDate.parse("2009-01-01",DateTimeFormatter.ISO_DATE);
LocalDate localDate = LocalDate.now();
sout(localDate.format(DateTimeFormatter.ISO_DATE));
Between
- Number of days between two local date
import static java.time.temporal.ChronoUnit.DAYS;
DAYS.between(from,to)
Format
With javase/9/docs/api/java/time/format/DateTimeFormatter.html. Note this is a datetime otherwise
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HHmm"))
note:
- HH will always output 2 digits whereas H will only output one digit (same for (m and mm)
- ppH outputs the hour-of-day padded on the left with spaces to a width of 2.