javascript length duration
<p>i have following function in php, how can i convert this in javascript?</p>

<pre><code> function length_duration ($seconds)
 {
  $hours = $mins = $sec = NULL;

  //for seconds
  if($seconds &gt; 0)
   $sec = ($seconds % 60 &lt; 10) ? "0".($seconds%60) : ($seconds%60);

  //for mins
  if($seconds &gt; 60)
   $mins  = (($seconds/60%60)&lt;10) ? "0".($seconds/60%60).":" : "".($seconds/60%60).":";

  //for hours
  if($seconds/60 &gt; 60)
   $hours = (($seconds/60/60) &lt; 10) ? "0".($seconds/60/60).":" : "".($seconds/60/60).":";

  return $hours.$mins.$sec;
 }
</code></pre>
