Trying to convert timespan value to decimal
Hello everyone,
I am trying to use a timespan value for calculating different values,
Like subtracting, dividing and multiplying with other decimal values but in vain.
Below is the code I used to arrive at the timespan value (no of days) between two dates.
DateTime endate = convert.ToDateTIme(transdate.Text);
DateTime startdate = convert.ToDateTIme(lastdate.Text);
TimeSpan Nodays = enddate.Subtract(startdate);
Int NumberOfDays = No.Days;
LabelNoOfDays.Text = NumberOfDays.ToString();
So am trying to use the value (number of days) in label "LabelNoOfDays.Text" but in vain
Any help will be appreciated.


Nitin SontakkeRank #264 · 9.6K reputationPosted Apr 2, 2017, 11:31 PM EDT
Ramesh PalanivelRank #372 · 6.8K reputationPosted Apr 2, 2017, 11:53 PM EDT
Rafnas T PRank #280 · 8.8K reputationPosted Apr 3, 2017, 1:06 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Apr 3, 2017, 2:26 AM EDT