@@ -0,0 +1,2711 @@
+package com.es.lib.common.time;%0A%0Aimport com.es.lib.common.DateUtil;%0Aimport com.es.lib.common.Pluralizer;%0A%0Aimport java.time.Duration;%0Aimport java.time.LocalDateTime;%0Aimport java.time.Period;%0Aimport java.util.Date;%0A%0A/**%0A * @author Zuzoev Dmitry - zuzoev.d@ext-system.com%0A * @since 10.05.2018%0A */%0Apublic final class PeriodUtil %7B%0A%0A    private static final int MINUTES_PER_HOUR = 60;%0A    private static final int SECONDS_PER_MINUTE = 60;%0A    private static final int SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;%0A%0A    public static String pretty(Date date, boolean useBraces) %7B%0A        return pretty(DateUtil.convert(date), useBraces);%0A    %7D%0A%0A    public static String pretty(LocalDateTime date, boolean useBraces) %7B%0A        return pretty(date, LocalDateTime.now(), useBraces);%0A    %7D%0A%0A    public static String pretty(Date date, Date dateNext, boolean useBraces) %7B%0A        return pretty(DateUtil.convert(date), DateUtil.convert(dateNext), useBraces);%0A    %7D%0A%0A    public static String pretty(LocalDateTime date, LocalDateTime dateNext, boolean useBraces) %7B%0A        if (date == null %7C%7C dateNext == null) %7B%0A            return null;%0A        %7D%0A        Period period = Period.between(date.toLocalDate(), dateNext.toLocalDate());%0A        long%5B%5D time = getTime(date, dateNext);%0A        StringBuilder sb = new StringBuilder();%0A        if (period.getYears() %3E 0) %7B%0A            sb.append(period.getYears()).append(%22 %22).append(Pluralizer.evaluate(period.getYears(), %22%D0%B3%D0%BE%D0%B4%22, %22%D0%B3%D0%BE%D0%B4%D0%B0%22, %22%D0%BB%D0%B5%D1%82%22));%0A        %7D%0A        if (period.getMonths() %3E 0) %7B%0A            sb.append(period.getMonths()).append(%22 %D0%BC%D0%B5%D1%81.%22);%0A        %7D%0A        if (period.getDays() %3E 0) %7B%0A            sb.append(period.getDays()).append(%22 %D0%B4%D0%BD.%22);%0A        %7D%0A        if (time%5B0%5D %3E 0) %7B%0A            sb.append(time%5B0%5D).append(%22 %D1%87.%22);%0A        %7D%0A        if (time%5B1%5D %3E 0) %7B%0A            sb.append(time%5B1%5D).append(%22 %D0%BC.%22);%0A        %7D%0A        if (time%5B2%5D %3E 0) %7B%0A            sb.append(time%5B2%5D).append(%22 c.%22);%0A        %7D%0A        String result = sb.toString();%0A        if (useBraces) %7B%0A            result = %22(%22 + result + %22)%22;%0A        %7D%0A        return result;%0A    %7D%0A%0A    private static long%5B%5D getTime(LocalDateTime date, LocalDateTime dateNext) %7B%0A        LocalDateTime original = LocalDateTime.of(dateNext.getYear(),%0A            dateNext.getMonthValue(), dateNext.getDayOfMonth(), date.getHour(), date.getMinute(), date.getSecond());%0A        Duration duration = Duration.between(original, dateNext);%0A%0A        long seconds = duration.getSeconds();%0A%0A        long hours = seconds / SECONDS_PER_HOUR;%0A        long minutes = ((seconds %25 SECONDS_PER_HOUR) / SECONDS_PER_MINUTE);%0A        long secs = (seconds %25 SECONDS_PER_MINUTE);%0A%0A        return new long%5B%5D%7Bhours, minutes, secs%7D;%0A    %7D%0A%7D%0A

Add pretty print interval util