Determine if a day of week and time fall in a custom weekend period
- by Y Low
I've been trying to come up with a method, that given a day of week and time of day, it will return if it falls under a custom weekend period.
The weekend period is saved in 4 variables as follows:
The day of week when it starts (0-6)
The time of day when it starts (0-23)
The day of week when it ends (0-6)
The time of day when it ends (0-23)
Based on these fields, the weekend period can be anything the user selected (even if it is well beyond a regular weekend)
I've been banging this one for awhile but to no avail. I'm trying this in delphi but any language will do, as I'm looking for the algorithm and not the implementation.