java.lang.Object
ch.tocco.nice2.optional.timereport.impl.util.DateUtil

public abstract class DateUtil extends Object
class providing static utilities for Date
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    getDaysDifference(org.joda.time.LocalDate reference, org.joda.time.LocalDate other)
     
    static org.joda.time.LocalDate
     
    static org.joda.time.LocalDate
    getLastDayInYear(int year)
     
    static boolean
    intersect(org.joda.time.LocalDate from1, @Nullable org.joda.time.LocalDate until1, org.joda.time.LocalDate from2, @Nullable org.joda.time.LocalDate until2)
     
    static boolean
    isInDaysPeriod(org.joda.time.LocalDate date, org.joda.time.LocalDate start, @Nullable org.joda.time.LocalDate end)
     
    static org.joda.time.LocalDate
    max(org.joda.time.LocalDate... dates)
     
    static org.joda.time.LocalDate
    min(org.joda.time.LocalDate... dates)
     
    static Duration
    Round a duration to the nearest minutes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • max

      public static org.joda.time.LocalDate max(org.joda.time.LocalDate... dates)
      Parameters:
      dates - a list of dates @return the largest date from the list
      Returns:
      the max date in the list
    • min

      public static org.joda.time.LocalDate min(org.joda.time.LocalDate... dates)
      Parameters:
      dates - a list of dates
      Returns:
      the smallest date from the list
    • getDaysDifference

      public static int getDaysDifference(org.joda.time.LocalDate reference, org.joda.time.LocalDate other)
      Parameters:
      reference - the reference date
      other - an other date
      Returns:
      The difference in days between the two dates. If other > reference the result is > 0.
    • roundToMinutes

      public static Duration roundToMinutes(Duration duration)
      Round a duration to the nearest minutes.
      Parameters:
      duration - duration to round
      Returns:
      a Duration rounded to minues
    • isInDaysPeriod

      public static boolean isInDaysPeriod(org.joda.time.LocalDate date, org.joda.time.LocalDate start, @Nullable @Nullable org.joda.time.LocalDate end)
      Parameters:
      date - the reference date
      start - the start date
      end - the end date (is considered if null)
      Returns:
      true if and only if reference ∈ [start, end]
    • intersect

      public static boolean intersect(org.joda.time.LocalDate from1, @Nullable @Nullable org.joda.time.LocalDate until1, org.joda.time.LocalDate from2, @Nullable @Nullable org.joda.time.LocalDate until2)
    • getFirstDayInYear

      public static org.joda.time.LocalDate getFirstDayInYear(int year)
    • getLastDayInYear

      public static org.joda.time.LocalDate getLastDayInYear(int year)