Determine if a day of week and time fall in a custom weekend period
        Posted  
        
            by Y Low
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Y Low
        
        
        
        Published on 2010-03-22T20:18:41Z
        Indexed on 
            2010/03/22
            20:21 UTC
        
        
        Read the original article
        Hit count: 346
        
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.
© Stack Overflow or respective owner