java.lang.Object
records.util.DateTimeCalculator
Utility class for date and time calculations.
Provides methods for calculating total hours worked, total overtime hours, regular hours worked,
adjusted time in, total number of days, months, and years between two dates, and calculating overtime hours.
Available methods:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LocalTime
adjustedTimeIn
(LocalTime timeIn) Adjusts the time in if it's before or equal to the grace period.static LocalTime
overtimeHours
(LocalTime timeIn, LocalTime timeOut) Calculate overtime hours based on the time in and time out.static LocalTime
regularHoursWorked
(LocalTime timeIn, LocalTime timeOut) Calculates the regular hours worked between two times.static int
Calculates the total number of days between two dates.static int
totalDays
(List<AttendanceRecord> attendanceRecordList) Calculates the total number of days from a list of attendance records.static double
totalHoursWorked
(List<AttendanceRecord> attendanceRecordList) Calculates the total hours worked based on a list of attendance records.static int
totalMonths
(LocalDate startDate, LocalDate endDate) Calculates the total number of months between two dates.static double
totalOvertimeHours
(List<AttendanceRecord> attendanceRecordList) Calculates the total overtime hours based on a list of attendance records.static int
totalYears
(LocalDate startDate, LocalDate endDate) Calculates the total number of years between two dates.
-
Constructor Details
-
DateTimeCalculator
public DateTimeCalculator()
-
-
Method Details
-
totalHoursWorked
Calculates the total hours worked based on a list of attendance records.- Parameters:
attendanceRecordList
- the list of attendance records- Returns:
- the total hours worked
-
totalOvertimeHours
Calculates the total overtime hours based on a list of attendance records.- Parameters:
attendanceRecordList
- the list of attendance records- Returns:
- the total overtime hours
-
regularHoursWorked
Calculates the regular hours worked between two times.- Parameters:
timeIn
- the time intimeOut
- the time out- Returns:
- the regular hours worked
-
adjustedTimeIn
Adjusts the time in if it's before or equal to the grace period.- Parameters:
timeIn
- the time in- Returns:
- the adjusted time in
-
totalDays
Calculates the total number of days from a list of attendance records.- Parameters:
attendanceRecordList
- the list of attendance records- Returns:
- the total number of days
-
totalDays
Calculates the total number of days between two dates.- Parameters:
startDate
- the start dateendDate
- the end date- Returns:
- the total number of days
-
totalMonths
Calculates the total number of months between two dates.- Parameters:
startDate
- the start dateendDate
- the end date- Returns:
- the total number of months
-
totalYears
Calculates the total number of years between two dates.- Parameters:
startDate
- the start dateendDate
- the end date- Returns:
- the total number of years
-
overtimeHours
Calculate overtime hours based on the time in and time out.- Parameters:
timeIn
- the starting timetimeOut
- the ending time- Returns:
- the total overtime hours
-