You split the string by "End:", then work on individual string of the array. Something like this:
And of course, you need to implement errror handling to your code, like using Date.TryParse instead of Date.Parse.Code:Dim s As String = "Start: 10/8/2008 End: 10/14/2008" Dim parts() As String = s.Split("End:") Dim startDate As Date = Date.Parse(parts(0).Replace("Start:", "").Trim()) Dim endDate As Date = Date.Parse(parts(1).Trim())
Since you know the format of the date, you can also use Date.TryParseExact and pass in the date format.




Reply With Quote