Class DateTimeUtils


  • public class DateTimeUtils
    extends Object

    LocalTimeUtils

    The Date Time Utils Some helper methods for working with georgian calendar

    Since:
    3/23/2019
    Version:
    1.0
    Author:
    Mahdi Razavi
    • Method Detail

      • getAge

        public static int getAge​(LocalDate birthday,
                                 LocalDate currentDate)
        Calculate the age at the given date
        Parameters:
        birthday - the birthday
        currentDate - the current date
        Returns:
        age age
      • getAge

        public static int getAge​(LocalDate birthday)
        Calculate the age at the current time.
        Parameters:
        birthday - the birthday
        Returns:
        age age
      • isBetween

        public static boolean isBetween​(LocalDateTime givenDate,
                                        LocalDateTime startDate,
                                        LocalDateTime endDate)
        Checks the given date is between the two provided dates
        Parameters:
        givenDate - the given date
        startDate - the start date
        endDate - the end date
        Returns:
        boolean boolean
      • isLastDayOfTheMonth

        public static boolean isLastDayOfTheMonth​(LocalDate localDate)
        Returns whether the given date is the last day of the month
        Parameters:
        localDate - the local date
        Returns:
        boolean boolean
      • isWeekend

        public static boolean isWeekend​(LocalDate dt)
        Returns whether the given date falls in a weekend
        Parameters:
        dt - the dt
        Returns:
        boolean boolean
      • hasOverlap

        public static boolean hasOverlap​(Interval t1,
                                         Interval t2)
        Check t1 has overlap with t1 or not
        Parameters:
        t1 - first time
        t2 - second time
        Returns:
        return true if given period has overlap