JavaScript isolate and format hours and minutes as 4-digit number
<p>I'm working on a project where I need to get the hours and minutes alone without the semicolon (:) separating them, and represent them in a variable, <code>myTime</code>, as a 4-digit number. Here is my code:</p>

<pre><code>var now = new Date();
var time = now.toString().substr(16,5)
</code></pre>