I’m trying to make my string a nice formatted time but the column in the database isn’t set up as a date/time field is there anyway I can do this?
Here’s my query
Dim query as String = "Select * from openquery (devbook, 'SELECT wb.arrival_time FROM web_bookings wb ')"
And here’s where i’m converting it
Session("formattime") = DateTime.Parse(drv.Row("arrival_time")).ToString("hh:mm")
The arrival_time field only has 4 numbers in like this 1000 so I need a way of converting it to a nice format like this 10:00AM
I’m using VB by the way
Any ideas?
Thanks
Jamie
How about:
VB.NET
Outputs:
10:00 AM
Alternatively, if you plan on using that frequently, you might want to add that as an extension method.
–VB.NET–
Example:
VB.NET
Anything bad in the data will throw you an exception.
–EDIT–
Works fine in VB.NET.