Date.prototype.bfFormatter = function(){ var ret = ''; ret += this.getFullYear() + "-"; var month = this.getMonth() + 1; ret += dateAddPrefix(month) + "-"; var day = this.getDate(); ret += dateAddPrefix(day) + " "; var hour = this.getHours(); ret += dateAddPrefix(hour) + ":"; var minute = this.getMinutes(); ret += dateAddPrefix(minute) + ":"; var seconds = this.getSeconds(); ret += dateAddPrefix(seconds); return ret; }