Convert now to HH:MM:SS - Node.js Date

Node.js examples for Date:Hour

Description

Convert now to HH:MM:SS

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();
};

Related Tutorials