The ParseExact
method returns a DateTime
value, not a string. If you assign it to a string variable, you will automatically convert it, which uses standard formatting.
If you want it in a specific format, format the DateTime
value as a string:
Dim d As DateTime = DateTime.ParseExact(theTime,"HHmm", Nothing); Dim convertedTime As String = d.ToString("hh:mm tt")
Guffa source share