By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
 448,560 Members | 1,422 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,560 IT Pros & Developers. It's quick & easy.

# date math, omiting weekends and holidays,

 P: 98 This code omits weekends, holidays and returns a due date as well as the number of business days due. it also adds an extra day to the reqest if it was submitted after 5:00. as you can see that if the request is submitted between 12-pm and 12:59 pm, it is going to add an extra day to the count. how might add the condition that if 12 and pm, no extra days needed? Expand|Select|Wrap|Line Numbers  'if submitted after 4:59 PM then add a day if after 4:59 PM and a Friday add 2 days others wise add no extra days     loopend = Val(Me.Days) 'default # of days     DueDate = Me.Date_Submitted     If Right(Me.Date_Submitted, 2) = "PM" Then         colonPos = InStr(Me.Date_Submitted, ":")        ' If (Val(Mid(Me.Date_Submitted, colonPos - 2, 2)) > 4) And (Trim(Format(Date, "dddd")) = "Friday") Then 'get the day of the week           '  loopend = loopend + 1         If Val(Mid(Me.Date_Submitted, colonPos - 2, 2)) > 4 Then             loopend = loopend + 1           End If     End If Nov 13 '08 #1
Share this Question
1 Reply

 Expert 100+ P: 374 This code omits weekends, holidays and returns a due date as well as the number of business days due. it also adds an extra day to the reqest if it was submitted after 5:00. as you can see that if the request is submitted between 12-pm and 12:59 pm, it is going to add an extra day to the count. how might add the condition that if 12 and pm, no extra days needed? Expand|Select|Wrap|Line Numbers  'if submitted after 4:59 PM then add a day if after 4:59 PM and a Friday add 2 days others wise add no extra days     loopend = Val(Me.Days) 'default # of days     DueDate = Me.Date_Submitted     If Right(Me.Date_Submitted, 2) = "PM" Then         colonPos = InStr(Me.Date_Submitted, ":")        ' If (Val(Mid(Me.Date_Submitted, colonPos - 2, 2)) > 4) And (Trim(Format(Date, "dddd")) = "Friday") Then 'get the day of the week           '  loopend = loopend + 1         If Val(Mid(Me.Date_Submitted, colonPos - 2, 2)) > 4 Then             loopend = loopend + 1           End If     End If Expand|Select|Wrap|Line Numbers  'if submitted after 4:59 PM then add a day if after 4:59 PM and a Friday add 2 days others wise add no extra days     loopend = Val(Me.Days) 'default # of days     DueDate = Me.Date_Submitted     If Right(Me.Date_Submitted, 2) = "PM" Then         colonPos = InStr(Me.Date_Submitted, ":")        ' If (Val(Mid(Me.Date_Submitted, colonPos - 2, 2)) > 4) And (Trim(Format(Date, "dddd")) = "Friday") Then 'get the day of the week           '  loopend = loopend + 1        'If Val(Mid(Me.Date_Submitted, colonPos - 2, 2)) > 4 Then        '     loopend = loopend + 1           'End If         If TimeSerial(Hour(me.Date_Submitted),Minute(me.Date_Submitted),Second(me.Date_Submitted)) > #4:59PM# Then               loopend = loopend + 1         end if     End If     Nov 17 '08 #2

### Post your reply

Sign in to post your reply or Sign up for a free account.