TimeSpan TotalTime = TimeSpan.Parse(totalhours); if(TotalTime != null) { TimeSpan Percentage= ( TotalTime* 80 ) / 100; // here I need to get correct percentage in hrs // If TotalTime is 10 hrs then Percentage should be 8 hrs }
TotalHours
TimeSpan
TimeSpan TotalTime =(DateTime.Now.AddHours(10)-DateTime.Now); // sample code give you 10 hours for testing double Percentage =hours.TotalHours*.8; // for above value you will get 8 as percentage
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)