B4X:
Sub DaysInMonth(Mth As Int, Year As Int) As Int
Dim Days, DaysPerMonth() As Int
DaysPerMonth = Array As Int (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
Days = DaysPerMonth(Mth)
If Mth = 1 AND (Year Mod 4 = 0) AND Not(Year Mod 100 = 0) Then
Days = 29
End If
Return Days
End Sub
Another one to add to DateTime. in the future.
Pass the month and year and return the number of days in that month - taking into account leap years. 0 based.
Thanks to Klaus - extracted form his code in ClsWheel....
------------------------------------
I need to populate the selected month of a calendar with either week day events OR weekend events in a batch. It should not be difficult to figure out which integer days are week days or weekends...
------------------------------------