Number of weekdays(in hours) between 2 days

dear all,I need a LS to get number of working days between today and a past date…i need to exclude holidays as well i have holidays in a view…here is my code to get the number of hours between the two days

Dim se As New NotesSession

'Dim ws As New NotesUIWorkspace 

Dim db As NotesDatabase

Dim doc, mDoc As NotesDocument

Dim mailDoc As NotesDocument 

'Dim cdoc As NotesUIDocument

Dim cdcl,cdclM As NotesDocumentCollection

Dim rtitem As notesrichtextitem



Dim sFormula As String

Dim  iNum As Integer

Dim iLoop As Integer

Dim idate As Variant 

Dim HourCount  As Variant

Dim dt As New NotesDateTime("Today")



Dim sToday



Set db=se.CurrentDatabase

'Set cdoc=ws.CurrentDocument 



sToday =Cstr(Today)

sFormula = "Form = ""LAS_AdminHolidayForm_Frm"""	

'sFormula = sFormula & " & LAS_AdminHoliday = @TextToTime(""" & sToday & """)"	

Set cdclM =db.Search (sFormula, Nothing, 0)



If cdclM.Count = 0 Then

	

	sFormula = "Form = ""LAS_MainLone_Frm"""

	sFormula = sFormula & " & LAS_MainLone_Status != ""Terminated"""

	sFormula = sFormula & " & LAS_MainLone_Status != ""Facility Declined"""	

	sFormula = sFormula & " & LAS_MainLone_Status != ""Noted"""	

	sFormula = sFormula & " & DeleteIndi = """""	

	

	Set cdcl =db.Search (sFormula, Nothing, 0)

	For iLoop=1 To cdcl.count

		Set doc=cdcl.GetNthDocument (iLoop)

		If doc.EscalateTime(0)<>"" Then

			

			

			idate=Now()-doc.EscalateTime(0)

			HourCount=idate*24

			doc.EscHours=Cstr(HourCount)

		End If

		

		Call doc.save(False,False)

	Next	

End If

Subject: number of weekdays(in hours) between 2 days

I’m guessing you want to exclude weekends also?

Also are the dates across multiple years? Do your Holidays differ year to year? (Assume yes) Do your Holiday list ever include Holidays that might happen on a weekend?

I would first try and use @Businessdays using evaluate. You can probably build your list of exclude (holidays) just by year, I’m guessing @Businesdays would be OK with dates outside your range.

Get the year of the start date

Get the year of the end date

Loop from start date year to end date year - building your list of dates to enclude

Then build the @BusinessDate(start date;end date;1:7; [list of dates] )

Subject: number of weekdays(in hours) between 2 days

I suggest that you do a search for an algorithm on the web to produce your question. It does not look, that your question is actually Lotusscript related.