SOURCE

function getNowTime(){
  Number.prototype.Totwo = function(){
    return ('0' + this).slice(-2)
  }
  var time = new Date();
  var y = time.getFullYear().Totwo();
  var m = (time.getMonth()+1).Totwo();
  var d = time.getDate().Totwo();
  var h = time.getHours().Totwo();
  var mn = time.getMinutes().Totwo();
  var s = time.getSeconds().Totwo();
  delete Number.prototype.Totwo;
  return y+'-'+m+'-'+d+' '+h+':'+mn+':'+s
}

console.log(getNowTime())
console 命令行工具 X clear

                    
>
console