Time Periods

mugman17

Registered User.
Local time
Today, 18:12
Joined
Nov 17, 2000
Messages
110
Is there a way to find out ,lets say ,how many Januarys have passed between two dates?
 
Well you could use the datediff and dateadd functions...

function NumJanuary(Date1 as date, Date2 as date) as integer

dim NumYears as integer
dim ctr as integer
dim JanuaryCount as integer

JanuaryCount = 0
NumYears = datediff("yyyy",Date1, Date2)

for ctr = 1 to NumYears
if month(dateadd("yyyy",ctr,Date1)) = 1 then
JanuaryCount = JanuaryCount + 1
endif
next ctr

NumJanuary = JanuaryCount

end function

Hope this function helps for you...

Doug

[This message has been edited by D-Fresh (edited 07-26-2001).]

[This message has been edited by D-Fresh (edited 07-26-2001).]
 

Users who are viewing this thread

Back
Top Bottom