Public Function Pasqua(ByVal Anno As Integer) As Date
'Il metodo è valido per tutti gli anni nel Calendario Gregoriano,
'ossia dal 1583 in poi
Dim A%, B%, C%, P%, Q%, R%
A = Anno% Mod 19: B = Anno% 100: C = Anno% Mod 100
P = (19 * A + B - (B 4) - ((B - ((B + 8) 25) + 1) 3) + 15) Mod 30
Q = (32 + 2 * ((B Mod 4) + (C 4)) - P - (C Mod 4)) Mod 7
R = (P + Q - 7 * ((A + 11 * P + 22 * Q) 451) + 114)
Pasqua = DateSerial(Anno%, R 32, (R Mod 31) + 1)
End Function
Public Function IsFestivo(ByVal Data As Date) As Boolean 'Riferito ai festivi del calendario italiano
Dim Giorni_Festivi() As Variant, Data_Pasqua As Date, Festivo
Data_Pasqua = Pasqua(Year(Data))
Giorni_Festivi = Array("1-1", "6-1", "25-04", "1-5", "2-6", "15-8", "1-11", "8-12", "25-12", "26-12", Data_Pasqua, Data_Pasqua + 1)
IsFestivo = False
For Each Festivo In Giorni_Festivi
If Day(Data) = Day(Festivo) And Month(Data) = Month(Festivo) Then
IsFestivo = True
Exit For
End If
Next Festivo
End Function
Public Function IsWeekEnd(ByVal Data As Date) As Boolean 'Fine Settimana In Italia (Sabato e Domenica)
If Weekday(Data, vbMonday) < 6 Then
IsWeekEnd = False
Else
IsWeekEnd = True
End If
End Function
|