Javascript Date formattedTime()

Description

Javascript Date formattedTime()


Date.prototype.formattedTime = function(){
  var hours   = (this.getHours() < 10 ? "0" : "")   + this.getHours();
  var minutes = (this.getMinutes() < 10 ? "0" : "") + this.getMinutes();
  var seconds = (this.getSeconds() < 10 ? "0" : "") + this.getSeconds();
  return hours + ':' + minutes + ':' + seconds
}



PreviousNext

Related