java.lang.Object
records.util.DateTimeUtils
Utility class for handling date and time operations.
Available methods:
getWeekNumber(LocalDate)
getWeeklyPeriod_StartDate(LocalDate, int)
getWeeklyPeriod_EndDate(LocalDate, int)
getSemiMonthlyPeriod_StartDate(LocalDate, int)
getSemiMonthlyPeriod_EndDate(LocalDate, int)
getMonthlyPeriod_StartDate(LocalDate)
getMonthlyPeriod_EndDate(LocalDate)
getAnnualPeriod_StartDate(LocalDate)
getAnnualPeriod_EndDate(LocalDate)
now()
currentTime()
getPeriodStartDate_Current(String)
getPeriodStartDate_WithMonth(String, int)
getPeriodEndDate_Current(String)
getPeriodEndDate_WithMonth(String, int)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LocalTime
Retrieves the current time truncated to minutes.static LocalDate
Retrieves the end date of the current year.static LocalDate
Retrieves the start date of the current year.static LocalDate
Retrieves the end date of the current month.static LocalDate
Retrieves the start date of the current month.static LocalDate
getPeriodEndDate_Current
(String period) Retrieves the end date of the specified period.static LocalDate
getPeriodEndDate_WithMonth
(String period, int month) Retrieves the end date of the specified period.static LocalDate
getPeriodStartDate_Current
(String period) Retrieves the start date of the specified period.static LocalDate
getPeriodStartDate_WithMonth
(String period, int month) Retrieves the start date of the specified period.static LocalDate
getSemiMonthlyPeriod_EndDate
(LocalDate date, int semiMonthNo) Retrieves the end date of the current semi-monthly pay period.static LocalDate
getSemiMonthlyPeriod_StartDate
(LocalDate date, int semiMonthNo) Retrieves the start date of the current semi-monthly pay period.static int
getSemiMonthNo
(LocalDate date) Retrieves the semi-month number of the specified date.static LocalDate
getWeeklyPeriod_EndDate
(LocalDate date, int weekNo) Retrieves the end date of the current week.static LocalDate
getWeeklyPeriod_StartDate
(LocalDate date, int weekNo) Retrieves the start date (Monday) of the specified week number.static int
getWeekNumber
(LocalDate date) Retrieves the week number of the specified date.static LocalDate
now()
Retrieves the current date.
-
Constructor Details
-
DateTimeUtils
public DateTimeUtils()
-
-
Method Details
-
getWeekNumber
Retrieves the week number of the specified date.- Parameters:
date
- the date- Returns:
- the week number of the specified date
-
getSemiMonthNo
Retrieves the semi-month number of the specified date.- Parameters:
date
- the date- Returns:
- the
-
getWeeklyPeriod_StartDate
Retrieves the start date (Monday) of the specified week number.- Parameters:
date
- the dateweekNo
- the week number- Returns:
- the start date (Monday) of the specified week number
-
getWeeklyPeriod_EndDate
Retrieves the end date of the current week.- Parameters:
date
- the dateweekNo
- the week number- Returns:
- the end date of the current week
-
getSemiMonthlyPeriod_StartDate
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
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
Retrieves the start date of the current month.- Parameters:
date
- the date- Returns:
- the start date of the current month
-
getMonthlyPeriod_EndDate
Retrieves the end date of the current month.- Parameters:
date
- the date- Returns:
- the end date of the current month
-
getAnnualPeriod_StartDate
Retrieves the start date of the current year.- Parameters:
date
- the date- Returns:
- the start date of the current year
-
getAnnualPeriod_EndDate
Retrieves the end date of the current year.- Parameters:
date
- the date- Returns:
- the end date of the current year
-
now
Retrieves the current date.- Returns:
- the current date
-
currentTime
Retrieves the current time truncated to minutes.- Returns:
- the current time truncated to minutes
-
getPeriodStartDate_Current
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
Retrieves the start date of the specified period.- Parameters:
period
- the period for which to retrieve the start datemonth
- 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
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
Retrieves the end date of the specified period.- Parameters:
period
- the period for which to retrieve the end datemonth
- the month for which to retrieve the end date- Returns:
- the end date of the specified period
- Throws:
IllegalArgumentException
- if the period is invalid
-