java.sql.time or java.sql.timestamp comparing
Posted on 2004-10-11
I am trying some way to check if the current time is within a certain Range. For example, I want to have a range that goes from Tuesday at 8 am local time to Sunday at 10 am local Time. I would like these variables to be customizable by the way, but i would assume the formula wouldnt rely on a specific time. Then I want to be able to check if the current time is within that range. So if the current day is monday, it would not pass the check. However if the current time was wednesday it would pass. I can see how to do this if this was just one week, then i could compare it this one time, however i want it to be set up so it doesnt matter what week you are in as long as you are within the defined range.
so im guessing it would be something like this
1)define start time, start day, define end time, end day
2)check if current time and day are after starttime and before end time and same for days.
The part that confuses me is that i want it based on the Day of week, not date of month/year