Get time now and format as String - Node.js String

Node.js examples for String:Format

Description

Get time now and format as String

Demo Code


  Date.prototype.timeNow = function () {
    return ((this.getHours() < 10)?"0":"") + this.getHours() +":"+ ((this.getMinutes() < 10)?"0":"") + this.getMinutes() +":"+ ((this.getSeconds() < 10)?"0":"") + this.getSeconds();
  };//from w  w w .  ja va  2 s. co m

Related Tutorials