1
Answer

Converting Timespan to Decimal

durga prasad

durga prasad

16y
16.5k
1
Hi,
How to Convert TimeSpan to Decimal format, my code looks like this
 TimeSpan ts = new TimeSpan();
   ts = datetimepickerouttime.Value.TimeOfDay - datetimepickerintime.Value.TimeOfDay;
                    ts = ts.Subtract(TimeSpan.FromMinutes(30));
TextBox1.Text = Convert.ToDecimal(Convert.ToDecimal(ts.Hours) + (Convert.ToDecimal(ts.Minutes))).ToString("#.00");

Thanks in Advance,

Answers (1)