How to round to nearest hour using JavaScript Date Object
<p>I am working on a project that requires a time in the future to be set using the Date object.</p>

<p>For example:</p>

<pre><code>futureTime = new Date();
futureTime.setHours(futureTime.getHours()+2);
</code></pre>

<p>My questions is; once the future date is set, how can I round to the closest full hour and then set the futureTime var with it?</p>

<p>For example:</p>

<pre><code>Given 8:55 =&gt; var futureTime = 9:00
Given 16:23 =&gt; var futureTime = 16:00
</code></pre>

<p>Any help would be appreciated!</p>
