Javascript Date toLongTimeString()
var padZero = function(n) { return n < 10 ? '0' + n: n; }; Date.prototype.toLongTimeString = function() { var h = this.getHours(), s = this.getSeconds(),/*from ww w. java 2s. c om*/ m = this.getMinutes(); return padZero(h) + ':' + padZero(m) + ':' + padZero(s); };