Hi
I'm in the process of designing a database to identify if work can be performed during a time period.
I also have to take into account the day of the week but i've done this by testing against the start days allowed which are stored in a table.
So for example, a department allows work between 18:00 - 08:00.
I have a start time in the format dd/mm/yyyy hh:nn called start_date
and a end time in the format dd/mm/yyyy hh:nn called end_date
The solution I currently use is to think the wrong way round so i'm testing if the start time is between 08:00 and 18:00 if not thats OK.
I then perform the same on the end date, plus I calculate if the HOURDIFF is greater than the allowed window i.e 14hours.
Is their a better way to test if times are between a range that cross midnight?
Many Thanks
I'm in the process of designing a database to identify if work can be performed during a time period.
I also have to take into account the day of the week but i've done this by testing against the start days allowed which are stored in a table.
So for example, a department allows work between 18:00 - 08:00.
I have a start time in the format dd/mm/yyyy hh:nn called start_date
and a end time in the format dd/mm/yyyy hh:nn called end_date
The solution I currently use is to think the wrong way round so i'm testing if the start time is between 08:00 and 18:00 if not thats OK.
I then perform the same on the end date, plus I calculate if the HOURDIFF is greater than the allowed window i.e 14hours.
Is their a better way to test if times are between a range that cross midnight?
Many Thanks