Here you can find the source of getDurationString(LocalDateTime start, LocalDateTime end, ChronoUnit unit)
public static String getDurationString(LocalDateTime start, LocalDateTime end, ChronoUnit unit)
//package com.java2s; //License from project: Open Source License import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; public class Main { public static String getDurationString(LocalDateTime start, LocalDateTime end, ChronoUnit unit) { return unit.between(start, end) + " " + unit.name(); }/*from www . j a v a2 s . com*/ }