Innova
Innova

Reputation: 4981

Calculate time between two dates

i have a datepicker. i have found the difference between two dates using

DateTime  startdate = frmdate_starttime.Date;
DateTime  enddate = frmdate_endtime.Date;
TimeSpan ts1 = enddate.Subtract(startdate);

now i want to multiply the timespan value with 10 hrs . but 10 hrs is in datatype int. how can i multiply the timespan value with int val.

Upvotes: 1

Views: 2689

Answers (1)

Guffa
Guffa

Reputation: 700730

If you multiply a time with a time, you would get a very strange unit like hours squared... I assume that you want to multiply the number of days in the time span by ten hours:

int hours = ts1.Days * 24 * 10

Upvotes: 1

Related Questions