Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaDuration vs PeriodSingle-choice MCQ

Why does Duration.between(start, end) throw an exception when start and end are LocalDate instances, but works fine with LocalDateTime?

LocalDate start = LocalDate.of(2024, 1, 1); LocalDate end = LocalDate.of(2024, 3, 1); Duration d = Duration.between(start, end); // ?