i need to convert strings to date format. the requirement is if current month is selected, the date should be getdate. if any other month is selected then it should be first of
You could use this function:
Private Function GetDate(ByVal source As String) As DateTime
Dim converted = DateTime.Parse(source)
If (converted.Year.Equals(DateTime.Now.Year) And converted.Month.Equals(DateTime.Now.Month)) Then
GetDate = DateTime.Now
Else
GetDate = converted
End If
End Function
it could analysed passed month + year values like "April 2010".