Adjust Date/Time To Next Business Day – Part II

June 16, 2007 – 12:29 pm

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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
	Wend
 
	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.

Related posts:

  1. Display Date Range As Bar In Notes Views (Part 2)
  2. Display Date Range As Bar In Notes Views
  3. Calculate Elapsed Time Between Two Date/Time Values
  4. @BusinessDays In LS
  5. Adjust Date/Time To Next Business Day

Sorry, comments for this entry are closed at this time.