I have this kind of scenario. Let say I have setting for overtime such as below. It can be in array.
Array From Until
[0] 5:00 AM 7:00 AM
[1] 6:00 PM 9:00 PM
Then, I will come to work to have an overtime. How to check if the actual overtime clocking is fall under the time range above?
For example, I come for overtime at:
OT Start: 6:00 AM , OT End: 9:00 AM
So, I will get
OT Start Allowed OT End Allowed
6:00 AM 7:00 AM
For more scenario, if
OT Start OT End OT Start Allowed OT End Allowed
4:00 AM 6:30 AM 5:00 AM 6:30 AM
5:30 AM 8:00 AM 5:30 AM 7:00 AM
5:30 PM 8:00 PM 6:00 PM 8:00 PM
6:30 PM 9:30 PM 6:30 PM 9:00 PM
5:30 PM 9:30 PM 6:00 PM 9:00 PM
5:30 AM 7:00 PM 5:30 AM 7:00 AM
6:00 PM 7:00 PM
6:00 AM 10:00 PM 6:00 AM 7:00 AM
6:00 PM 9:00 PM
That's how the system should handle the scenario. Anyone have idea how to do this in php? Thank you in advance.