Last Day of the Month


/ Published in: Visual Basic
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Function LastDayOfMonth(MonthNbr As Byte, YearNbr As Integer) As Date
  2.  
  3. Dim theDay As Byte
  4.  
  5. For theDay = 1 To 32
  6. If Not IsDate(MonthNbr & "/" & theDay & "/" & YearNbr) Then
  7. theDay = theDay - 1
  8. LastDayOfMonth = CDate(MonthNbr & "/" & theDay & "/" & YearNbr)
  9. Exit Function
  10. End If
  11. Next theDay
  12.  
  13. End Function

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.