السلام عليكم ورحمة الله وبركاته
يمكن وضع الكود الذي وضعه الأخ ALBRNS داخل دالة كاتالي
كود :
Private Sub Command1_Click()
MsgBox (DaysInMonth(1, 2012))
End Sub
Private Function DaysInMonth(month As Long, year As Long) As Long
DaysInMonth = DateSerial(year, month + 1, 1) - DateSerial(year, month, 1)
End Functionووجدت لك دالة MonthDays إن شاء الله تكون مفيدة
PHP كود :
Private Sub Command1_Click()
MsgBox(MonthDays(4, 2012))
End Sub
Private Function MonthDays(month As Long, year As Long) As Long
Select Case month
Case 2
If (year Mod 4 = 0) Then MonthDays = 29 Else MonthDays = 28
Case 4, 6, 9, 11
MonthDays = 30
Case Else
MonthDays = 31
End Select
End Function
السلام عليكم ورحمة الله وبركاته
