Converts a date into day/month/year format - Node.js Date

Node.js examples for Date:Date Format

Description

Converts a date into day/month/year format

Demo Code


/**//w  w w .  java2  s . com
 * Converts a date into day/month/year format
 * @method Date.stringify
 */
Date.prototype.stringify = function() {
  var h = parseInt(this.getHours() - 1, 10);
  var m = this.getMinutes();
  if (m < 10) {m = '0' + m;}
  var d = '';
  d += this.getDate() + '/' + parseInt(this.getMonth() + 1, 10) + '/' + this.getFullYear() + ' ';
  return d;
};

Related Tutorials