If currentDate.Day >= 1 And currentDate.Day <= 15 Then
Get the last date of the previous month
resultDate = New DateTime(currentDate.Year, currentDate.Month, 1).AddDays(-1)
Else
Use the current date
resultDate = currentDate
End If
If currentDate.Day <= 15 Then
’ Get the last day of the previous month
resultDate = currentDate.AddDays(-currentDate.Day)
Else
’ Keep the current date
resultDate = currentDate
End If