Nodejs Utililty Methods Date Short Format

List of utility methods to do Date Short Format

Description

The list of methods to do Date Short Format are organized into topic(s).

Method

toShortDateString()
String.prototype.toShortDateString = function() {
  var date = new Date(this);
  return date.toDateString().substr(4);
};
module.exports = {
  toShortDateString: function(dateString) {
    var date = new Date(dateString);
    return date.getDate() + "/" + (date.getMonth() + 1) + "/" + date.getFullYear();
  },
...
toShortDateString()
Date.prototype.toShortDateString = function () {  
  var tempStr = '';
  var dayOfTheMonth = this.getDate();
  var month = this.getMonth();
  var year = this.getFullYear();
    tempStr += dayOfTheMonth.padWithDigits(2) + '-' + month.padWithDigits(2) + '-' + year.padWithDigits(4);
  return tempStr;  
};
toShortDateString()
Date.prototype.toShortDateString = function() {
    return this.getFullYear() + "/" + (this.getMonth() + 1) + "/" + this.getDate();
};