At the moment I calculate it "bare-metal":
Public Function LastDayOfMonth(Extends d As DateTime) As integer
Var monthdays() As Integer = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
Var result As Integer = monthdays[d.Month]
# Nur für Februar muss die Logik angewendet werden
If d.Month = 2 Then
# Die mathematisch kompakteste Form der Schaltjahr-Prüfung
If (d.Year Mod 4 = 0 And d.Year Mod 100 <> 0) Or (d.Year Mod 400 = 0) Then
result = 29
End If
End If
Return result
End Function