title: How to round time to nearest day?
body: <p>For my program, I need to round a timestamp (in ms) to the nearest day. To round to hours, I simply do this:</p>
  
  <pre><code>private static long roundToHour(long time)
  {
      //Add 0.5 hours and then cut off everything unnecessary.
      time += 1800000;
      time = time/(3600000);
      return time*3600000;
  }
  </code></pre>
  
  <p>But when I try to do a similar thing with the whole day, the code is 2 hours off. Can anyone please tell me why?</p>
  
  <pre><code>private static long roundToDay(long time)
  {
      time += 43200000;
      time = time/86400000;
      return time*86400000;
  }
  </code></pre>