c# - Convert TimeSpan to Double -
i'm having trouble convertion of timespan double. that's code used convert double value timespan:
int r = 150; string t = timespan.fromhours(convert.todouble(r)).tostring(@"dd\.hh\:mm\:ss"); it gives:
t--> 6.06:00:00
now need retrieve value (150) timespan (6.06:00:00).
you need total-hours given timespan?
double totalhours = t.totalhours; so don't convert timespan string store timespan.
gets value of current timespan structure expressed in whole , fractional hours.
if have string 6.06:00:00 , want number of hours, parse first timespan:
timespan ts = timespan.parse("6.06:00:00"); double hours = ts.totalhours;
Comments
Post a Comment