Operations on dates and times

suggest change
LocalDate tomorrow = LocalDate.now().plusDays(1);
LocalDateTime anHourFromNow = LocalDateTime.now().plusHours(1);
long daysBetween = java.time.temporal.ChronoUnit.DAYS.between(LocalDate.now(), LocalDate.now().plusDays(3)); // 3 unless the two now() calls fall on different dates
Duration duration = Duration.between(Instant.now(), ZonedDateTime.parse("2016-07-27T07:00:00+01:00[Europe/Stockholm]"));
// Stockholm was UTC+2 on that date. Java keeps the instant and resolves this to 08:00+02:00.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents