Link to home
Start Free TrialLog in
Avatar of tentavarious
tentavarious

asked on

converting string to timespan asp.net

Hello experts I have a value stored in a database as a string like so: hh:mm:ss  for example 00:34:32 which is 34 minutes and 32 seconds.  I need to convert this into a hours like so .5 hours.  How can I accomplish this?  
Avatar of stengelj
stengelj
Flag of United States of America image

Try this...
=============================
Dim myTime As DateTime = "#00:34:32#"
Dim myAltTime As String = CStr(Math.Round(CInt(myTime.Minute) / 60, 1)) & " hour(s)")
Response.Write("myAltTime")
=============================


It should output "0.5 Hour(s)"
ASKER CERTIFIED SOLUTION
Avatar of Edwin_C
Edwin_C
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial