Привет всем
Есть ли какая-нибудь функция по которой можно определить последний день конкретного месяца
С уважением
Private Function FindLastDay(strYear As String, Month As String) As Integer
Dim i As Integer
Dim TempDate As String
Dim TempDay As Integer
On Error Resume Next
TempDate = "01/" & Month & "/" & strYear
FirstDay = Weekday(TempDate, vbMonday)
For i = 31 To 28 Step -1
TempDate = i & "/" & Month & "/" & strYear
TempDay = Weekday(TempDate, vbMonday)
If TempDay <> 0 Then
Exit For
End If
Next i
FindLastDay = i
End Function
Function LastDay(ByVal ye As Long, ByVal mon As Long) As Long
If mon = 2 Then
If Month(DateSerial(ye, mon, 29)) = 2 Then LastDay = 29 Else LastDay = 28
Else
LastDay = Choose(mon, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
End If
End Function
Сейчас этот форум просматривают: Google-бот, Yandex-бот и гости: 2