forse ci sarà pure un altro modo
codice:
'--------------------------------------------------------------------------
'Restituisce vero o falso a seconda che l'anno passato come argomento
'sia bisestile
'--------------------------------------------------------------------------
function IsLeapYear(byval aYear)
If (aYear Mod 4 = 0 And aYear Mod 100 <> 0) Or (aYear Mod 400 = 0) Then
IsLeapYear = True
else
IsLeapYear = False
end if
end function
'-----------------------------------------------------------------------
'Restituisce il numero di giorni del mese. Ha come argomenti Anno e mese
'-----------------------------------------------------------------------
function DaysInMonth(byval aYear, byval aMonth)
Select Case aMonth
Case 4, 6, 9, 11 'aprile, giugno, settembre, novembre
DaysInMonth = 30
Case 1, 3, 5, 7, 8, 10, 12 'gennaio, marzo, maggio,luglio,agosto,ottobre,dicembre
DaysInMonth = 31
Case 2 'febbraio
'è bisestile?
if IsLeapYear(aYear) then
DaysInMonth = 29
else
DaysInMonth = 28
end if
End Select
end function