PDA

View Full Version : list months within 2 dates


esthera
08-30-2006, 08:49 AM
If I have 2 dates for example 3/14/2006 8/30/2006
How can I list all the months included in these 2 days in an array.
(meaning answer would be
3
4
5
6
7
8
)

Spudhead
08-30-2006, 03:32 PM
taking a rough stab at it:


function monthRange(sDate1, sDate2)
iStartMonth = month(sDate1)
iEndMonth = month(sDate2)
sMonths = ""

for i=iStartMonth to iEndMonth
sMonths = sMonths & "," & i
next

aMonths = split(sMonths, ",")
monthRange = aMonths
end function