Date Adjustment To Weekday (Script)
The number of days you want to adjust the date by. The function is useful when
the user needs a date adjusted, but the date must be a weekday. This function
does not take into account Holidays.
Function FindWeekDay (tempdate As String, daysadjust As Integer) As String
Dim wd As Integer ' Weekday
Dim date1 As New NotesDateTime (tempdate)
date1.Adjustday(daysadjust) ' Adjust the 'date by the number of days
specified (Second 'argument).
wd = Weekday(date1.lslocaltime) ' Number for 'the day of the week.
While wd = 1 Or wd = 7 ' If the day is Sat '(7) or Sun (1)
date1.Adjustday(1) 'then increment the 'date the next Monday.
wd = Weekday(date1.lslocaltime) ' Reset 'the weekday variable
Wend
'If wd is not 1 or 7 the adjusted date is returned
FindWeekDay = date1.lslocaltime
End Function