Let’s say we haveStartDate and EndDate and those are of type DateTime. If you want to have an int value as a result then: int theResult = (EndDate – StartDate).Days; And if you want to have a double value as a result then: double theResult = (EndDate – StartDate).TotalDays;
Tag: calculate
How to calculate the sum of the datatable column in asp.net?
To calculate the sum of a column in a DataTable use the DataTable.Compute method. DataTable dt; … int sumValue; sumValue = dt.Compute(“Sum(TheSumColumn)”, string.Empty);