Need to convert Time data to a string

I have a SQL query that returns a time.  i cannot for the life of me get it converted to a string.

I have tried everything I can think of.  HELP!!!
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Wayne Taylor (webtubbs)Connect With a Mentor AstronautCommented:
Hi danielrsmith,

Try something like this....

    Dim dTime As DateTime = "your time"
    Dim TimeString As String
    TimeString = dTime.ToString


HouseMusicConnect With a Mentor Commented:
You have a bunch of options,

changing your sql command to use convert is probably the easiest
SELECT  convert(varchar(50), yourdate, 101) as yourdatestring       *** 101 gives mm/dd/yyyy   1 gives a 2 dig year instead.

Or in your code use format(somedate,"d")

If your putting the date in a datagrid in an page and your trying to use the format property of a cell, make sure you turn off html encoding for that cell or it will not work.
All Courses

From novice to tech pro — start learning today.