Adjust Date/Time To Next Business Day – Part II

In my recent posting I showed a method to calculate the number of business days between one date and another. It is possible to exclude weekends and a list of dates, too.
How to adjust Date/Time to next business day, I’ve already described here.

When using the GetBusinessDays method from my recent posting, the code to adjust a date to the next business day can be reduced to at least this snippet:

Sub Click(Source As Button)
	Dim dtStart As String
	Dim dtEnd As String
	dtStart = Today
	dtEnd = dtStart

	Dim b As New BusinessDay("1:7","[18.06.2007]:[19.06.2007]:[20.06.2007]")
	Dim StartDT As NotesDateTime

	Set StartDT = New NotesDateTime (dtStart)
	While b.GetBusinessDays (dtStart,dtEnd ) = 0
		Call StartDT.AdjustDay(1)
		dtEnd = StartDT.DateOnly

	Msgbox StartDT.DateOnly
End Sub

This is a great example of how evaluating @formulas in LotusScript can save you a lot of time when you want to write a function which is not available in Script.