[Solved] How to add 30 minutes to time as hours and minutes


Try this way to add minutes to your time string.

function addMinutesToTime(time, minsAdd) {
  function z(n){ 
     return (n<10? '0':'') + n;
    };
  var bits = time.split(':');
  var mins = bits[0]*60 + +bits[1] + +minsAdd;
  return z(mins%(24*60)/60 | 0) + ':' + z(mins%60);  
} 

result=addMinutesToTime('5:31',30);
alert(result);

SEE FIDDLE

1

solved How to add 30 minutes to time as hours and minutes