7 replies
dim lngDateDiff as long
'Date2 is later date
lngDateDiff=dtDate2-dtDate1
Hope this helps
John
by khalid
Sorry, didn't read the question properly.
Use the weekday function to determine the day of the week, add the appropriate number of days to get to the first Sunday. Your answer should be int(dtDate2-dtFirstSunday).
Haven't actually tried it out but it should work. Also, you may not want to count the original first date if it is a Sunday.
by khalid
by rsv
Dim d1 As Date
Dim d2 As Date
Dim dd As String
Dim c As Integer
Dim i As Integer
d1 = Date
d2 = "06/15/2001" 'mm/dd/yy
dd = DateDiff("d", d2, d1, vbSunday, vbUseSystem)
For i = 0 To Int(dd) - 1
dd = Weekday(DateAdd("d", i, d2), vbSunday)
If dd = 1 Then
c = c + 1
End If
Next
MsgBox "Total Sundays between " & d2 & " and " & d1 & " are " & c
Hope this helps you.
GOOD LUCK...:)
by khalid
by khalid
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending