[ad_1]
So i have the following table for an employee Leave :
id numberOfDays approved end_date reason start_date employee_id
1 6 true "2022-05-31 11:00:00" "sickness" "2022-05-24 10:00:00" 8
2 0.25 true "2022-05-17 14:00:00" "sickness" "2022-05-13 09:00:00" 8
3 1 true "2022-05-11 08:00:00" "family" "2022-05-09 08:00:00" 8
Given a specific date (day) , I want to calculate how many leave hours did that employee take. ( a work day is from 08:00 -> 12:00 and 14:00 -> 18:00 )
for example, for employee_id = 8 and day = “2022-24-2022” , my desired output would be 6 hours because the leave started from 2022-05-24 at 10:00
for employee_id=8 and day “2022-05-31”, output would be 3 hours ( the employee didnt work from 08:00 to 11:00 )
for employee_id=8 and day=”2022-05-09″ , output would be 8
[ad_2]