Calculate QuaterlyHour from Given two DateTimes in c#
- by user281947
I want to calculate the quarter Hour from the given two datetimes:
Suppose datetime1 and datetime2 , i am doing somewhat like this :
int d = datetime2.Subtract(datetime1).Hours;
double l = Math.Round(Convert.ToDouble(d/4));
but if the QuarterHour is 3 (ie d=3), whats the good way to show the output- should it be zero or the round one :
3/4 = 0.75. so should i round up to 1 or 0 is ok.
And if round up to 1..how should i?