How to show end of month with VB.Net?

Function show end of month for VB.Net
Public Function MonthEnd(ByVal pDate As Object) As Object
	On Error GoTo MonthEnd_Err
	Dim dd As Integer

	dd = DateAndTime.Day((DateSerial(Year(pDate), Month(pDate), 28).AddDays(4)))
	MonthEnd = DateSerial(Year(pDate), Month(pDate), 28).AddDays(4).AddDays(-dd)
MonthEnd_Exit:
	Exit Function
MonthEnd_Err:
	MonthEnd = 0
	Resume MonthEnd_Exit
End Function

 

You May Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *