rounding down

helllooooo.

im having a problem making a simple converter of minutes, into hours and minutes left over. when it gets to the upper part of the 60 minutes, the hours label goes up to 1 hour and it may say 1 hour and 45 minutes, for 45 total minutes. this is because it rounds up itself, is there a way to round this label down or sumthing




Answer this question

rounding down

  • MichaelDraisey

    If you have a number of minutes, you could pass it into a DateTime constructor, with all 0s for other values and so pull out hours and minutes afterward.

    Or you could use Math.Floor(minutes/60) and minutes%60 to calculate it yourself. The first rounds down the hours value and the second finds the remainder.



  • rounding down