Forum Moderators: open
What I need to do is I am writing a date select, usually I will use Date() as the start date and time, however post 6pm Friday until Sunday 23:59:59 I want to start the date on the following Monday 00:00:00, all the other time just use Date().
Any pointers on how to do this, I can obviously find out if it is Friday, Sat or Sun by using the Day() command but this doesn't let me check for post 6pm Friday and also I am a bit flumoxed on how to work out the coming Monday
Many thanks
The key is figuring out how many minutes into the week we are; if we are greater than 8280? minutes into the week, then it is after 6pm Friday.
The? after the 8280 is my way of telling you that you should double-check my math!
Calculate the previous Sunday from Now
Do a Datediff to calculate the number of minutes from last Sunday to Now (8280?)
If the number of minutes exceeds Friday at 6:00 pm (8280?), return next Monday.
dateToday = Date()
Select Case Weekday(dateToday)
Case 1, 2, 3, 4
startDate = dateToday
Case 5
If Hour(Time()) < 18 Then
startDate = dateToday
Else
startDate = dateToday + 3
End If
Case 6
startDate = dateToday + 2
Case 7
startDate = dateToday + 1
End Select