Package records.util

Class DateTimeUtils

java.lang.Object
records.util.DateTimeUtils

public class DateTimeUtils extends Object
  • Constructor Details

    • DateTimeUtils

      public DateTimeUtils()
  • Method Details

    • getWeekNumber

      public static int getWeekNumber(LocalDate date)
      Retrieves the week number of the specified date.
      Parameters:
      date - the date
      Returns:
      the week number of the specified date
    • getSemiMonthNo

      public static int getSemiMonthNo(LocalDate date)
      Retrieves the semi-month number of the specified date.
      Parameters:
      date - the date
      Returns:
      the
    • getWeeklyPeriod_StartDate

      public static LocalDate getWeeklyPeriod_StartDate(LocalDate date, int weekNo)
      Retrieves the start date (Monday) of the specified week number.
      Parameters:
      date - the date
      weekNo - the week number
      Returns:
      the start date (Monday) of the specified week number
    • getWeeklyPeriod_EndDate

      public static LocalDate getWeeklyPeriod_EndDate(LocalDate date, int weekNo)
      Retrieves the end date of the current week.
      Parameters:
      date - the date
      weekNo - the week number
      Returns:
      the end date of the current week
    • getSemiMonthlyPeriod_StartDate

      public static LocalDate getSemiMonthlyPeriod_StartDate(LocalDate date, int semiMonthNo)
      Retrieves the start date of the current semi-monthly pay period.
      Parameters:
      date - the date
      Returns:
      the start date of the current semi-monthly pay period
    • getSemiMonthlyPeriod_EndDate

      public static LocalDate getSemiMonthlyPeriod_EndDate(LocalDate date, int semiMonthNo)
      Retrieves the end date of the current semi-monthly pay period.
      Parameters:
      date - the date
      Returns:
      the end date of the current semi-monthly pay period
    • getMonthlyPeriod_StartDate

      public static LocalDate getMonthlyPeriod_StartDate(LocalDate date)
      Retrieves the start date of the current month.
      Parameters:
      date - the date
      Returns:
      the start date of the current month
    • getMonthlyPeriod_EndDate

      public static LocalDate getMonthlyPeriod_EndDate(LocalDate date)
      Retrieves the end date of the current month.
      Parameters:
      date - the date
      Returns:
      the end date of the current month
    • getAnnualPeriod_StartDate

      public static LocalDate getAnnualPeriod_StartDate(LocalDate date)
      Retrieves the start date of the current year.
      Parameters:
      date - the date
      Returns:
      the start date of the current year
    • getAnnualPeriod_EndDate

      public static LocalDate getAnnualPeriod_EndDate(LocalDate date)
      Retrieves the end date of the current year.
      Parameters:
      date - the date
      Returns:
      the end date of the current year
    • now

      public static LocalDate now()
      Retrieves the current date.
      Returns:
      the current date
    • currentTime

      public static LocalTime currentTime()
      Retrieves the current time truncated to minutes.
      Returns:
      the current time truncated to minutes
    • getPeriodStartDate_Current

      public static LocalDate getPeriodStartDate_Current(String period)
      Retrieves the start date of the specified period.
      Parameters:
      period - the period for which to retrieve the start date
      Returns:
      the start date of the specified period
      Throws:
      IllegalArgumentException - if the period is invalid
    • getPeriodStartDate_WithMonth

      public static LocalDate getPeriodStartDate_WithMonth(String period, int month)
      Retrieves the start date of the specified period.
      Parameters:
      period - the period for which to retrieve the start date
      month - the month for which to retrieve the start date
      Returns:
      the start date of the specified period
      Throws:
      IllegalArgumentException - if the period is invalid
    • getPeriodEndDate_Current

      public static LocalDate getPeriodEndDate_Current(String period)
      Retrieves the end date of the specified period.
      Parameters:
      period - the period for which to retrieve the end date
      Returns:
      the end date of the specified period
      Throws:
      IllegalArgumentException - if the period is invalid
    • getPeriodEndDate_WithMonth

      public static LocalDate getPeriodEndDate_WithMonth(String period, int month)
      Retrieves the end date of the specified period.
      Parameters:
      period - the period for which to retrieve the end date
      month - the month for which to retrieve the end date
      Returns:
      the end date of the specified period
      Throws:
      IllegalArgumentException - if the period is invalid