decimal time = 0; DateTime time1 = new DateTime(); DateTime time2 = new DateTime(); time1 = DateTime.Parse(ddl1.SelectedItem.Text);//ex..time1=DateTime.Parse(8:00AM); time2 = DateTime.Parse(ddl2.SelectedItem.Text);//ex.. time2=DateTime.Parsee(10:00AM); TimeSpan ts = time2.Subtract(time1);//ex.. ts= 10.00.Subtract(8:00) so ts=2:00 ll1.Text = Convert.ToString(ts);//ex.. ll1.Text=2:00; //this two line i dont have idea it is right or wrong. time = time + ts;//Error Cannot use + operator Decimal to System.TimeSpan Label2.Text = Convert.ToString(time);
TimeSpan time = TimeSpan.Zero; // ... time += ts; Label2.Text = time.ToString();
time += ts;
time = time + ts;
DateTime time1 = new DateTime(); DateTime time2 = new DateTime(); // 1st time dropdown selection time1 = DateTime.Parse("8:00AM"); time2 = DateTime.Parse("10:00AM"); TimeSpan ts = time2.Subtract(time1); // 02:00:00 // 2nd time dropdown selection time1 = DateTime.Parse("8:00AM"); time2 = DateTime.Parse("9:30AM"); TimeSpan ts1 = time2.Subtract(time1); // 01:30:00 TimeSpan tsTotal = ts + ts1; string t1 = Convert.ToString(tsTotal); // 03:30:00 Label2.Text = t1;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)