Marvin kakuru

Marvin kakuru

  • 1.4k
  • 354
  • 159.6k

Trying to convert timespan value to decimal

Apr 3 2017 2:11 AM
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.

Answers (4)