Create a dynamic 24 pay cycle array based off a start date of the 15th or last day.

A date string with a day of the 15th or last day (28th, 29th, 30th, 31st) is provided and a dynamic array with 24 cycles is created starting with that date.

Dim startcycle As New NotesDateTime( "01/15/2005" )	
Dim workingwithdate As NotesDateTime
Dim paycyclekeys(1 To 24) As Variant	
Dim x As Integer
For x = 1 To 24
	If x = 1 Then
		'just take the first cycle
		paycyclekeys(x) = startcycle.LSLocalTime
		'set to the previous cycle date
		Set workingwithdate = New NotesDateTime( paycyclekeys(x-1) )
		'increment to the next cycle from the previous
		If Day(workingwithdate.LSLocalTime)=15 Then
			'second half cycle (last day)
			Call workingwithdate.AdjustMonth( 1 )
			Call workingwithdate.AdjustDay( -15 )				
			paycyclekeys(x) = workingwithdate.LSLocalTime
			'next first half cycle (15th)
			Call workingwithdate.AdjustDay( 15 )
			paycyclekeys(x) = workingwithdate.LSLocalTime
		End If
	End If
Next x

Posted by fbrefere001 on Thursday February 9, 2006