current time with seconds
<p>I have strange problem .. i have a function to display the time with seconds counter but i sent specific time (hours and minutes) as parameters when count of second reach 59 no minutes incremented and i am not sure if the same problem with hours when minutes will be 59 minute</p>

<pre><code>function updateClock(current_hours,current_minutes) {
var currentTime = new Date ( );

var currentHours    = current_hours;
var currentMinutes  = current_minutes;
var currentSeconds  = currentTime.getSeconds ( );

// Pad the minutes and seconds with leading zeros, if required
currentMinutes = ( currentMinutes &lt; 10 ? "0" : "" ) + currentMinutes;
currentSeconds = ( currentSeconds &lt; 10 ? "0" : "" ) + currentSeconds;

// Choose either "AM" or "PM" as appropriate
var timeOfDay = ( currentHours &lt; 12 ) ? "AM" : "PM";

// Convert the hours component to 12-hour format if needed
currentHours = ( currentHours &gt; 12 ) ? currentHours - 12 : currentHours;

// Convert an hours component of "0" to "12"
currentHours = ( currentHours == 0 ) ? 12 : currentHours;

// Compose the string for display
var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;

// Big font time
$('.big_time').html("&lt;span&gt;&lt;/span&gt;" + currentTimeString);

// Time in red triangle in the track bar
$('.time').html(currentTimeString);
}
</code></pre>

<p>I call this function in another file inside document ready like that .. i sent here the data retrieved from an API (hours and minutes)</p>

<pre><code>current_hours   = data.current_hours;
current_minutes = data.current_minutes;

setInterval(function(){updateClock(current_hours,current_minutes)},1000);
</code></pre>
