Nodejs Utililty Methods Time Format

List of utility methods to do Time Format

Description

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

Method

getHm()
Date.prototype.getHm = function()
    var hh = this.getHours();
    if (hh < 10)
      hh = "0" + hh.toString();
    else
      hh = hh.toString();
    var mm = this.getMinutes();
    if (mm < 10)
      mm = "0" + mm.toString();
    else
      mm = mm.toString();
    return hh + ":" + mm;
};
Date.prototype.getYmd = function() {
  var yyyy = this.getFullYear().toString();
  var mm = (this.getMonth()+1).toString(); 
  var dd  = this.getDate().toString();
  return yyyy + (mm[1]?mm:"0"+mm[0]) + (dd[1]?dd:"0"+dd[0]); 
};
var days = ['SUN','MON','TUE','WED','THU','FRI','SAT'];
Date.prototype.getDayName = function() {
    return days[ this.getDay() ];
};