Get Number of Day from Two Datetime Picker Value

We can easily find out the Total number of day from Two Datetime Picker value using TimeSpan

  int totalDay=0;  
  TimeSpan ts = new TimeSpan(Convert.ToDateTime(objApplyLeave.Apply_ToDate).Ticks - Convert.ToDateTime(objApplyLeave.Apply_FromDate).Ticks);  
   totalDay = ts.TotalDays + 1 ;  

Popular posts from this blog

mvc razor textboxfor change event change another textboxfor value

WPF Crystal Report Viewer Using SAP

ASP.NET MVC razor SAP Crystal report