(funny old vb5) find out the last day of month
-
For i=31 to 28 Step -1
sDateTo = iMonth &"/" & i & "/" &iYear
If IsDate(sDateTo) Then Exit For
Next
p/s Enjoy)
-
Nice one! I assume this is a "clever" way of determining how many days are in the given month/year ?
-
Actually, this piece of magic (mushroom) code calculates the last day of specified month (so its maybe 31 or 30 or 29 or 28)))))
Here is less magic but still working code :
sDateTo = DateAdd("m",1,firstDayOfMonth)-1
-
I have used this code to figure out how many days in a month (y is the year you want to check, and m is the month you want to check):
[code]Day(DateSerial(y, m + 1, 0))[/code]