Is there any way to convert a SQLDateTime stamp to a ShortDate + ShortTime string?
In other words I want to convert: 2014-12-11 10:50:02
to: 12/11/2014 10:50 AM
Is there any way to do this?
Is there any way to convert a SQLDateTime stamp to a ShortDate + ShortTime string?
In other words I want to convert: 2014-12-11 10:50:02
to: 12/11/2014 10:50 AM
Is there any way to do this?
dim d as new date
d.SQLDateTime = s
dim result as string = d.ShortDate + " " + d.ShortTime
That should get you started at least.
That won’t work the SQLDateTime stamp is already in string format. Thanks though.
I should have been more clear I guess I am trying to convert a SQLDateTime stamp from a database result that is in string format into a date object that I can then convert into ShortDate + ShortTime.
That’s exactly what my code does. Please look again. “s” holds your SQLDateTime string.
Seems like this could work:
[code]Dim sqlDateTime As String = “2014-12-11 10:50:02”
Dim d As New Date
d.SQLDateTime = sqlDateTime
Dim convertedDate As String
convertedDate = d.ShortDate + " " + d.ShortTime[/code]
Paul, I didn’t know you could do that! Thanks!
Thanks to you both for the help I appreciate it!