Nodejs Hour Get getFullHours()

Here you can find the source of getFullHours()

Method Source Code

Date.prototype.getFullHours = function(){  // if hour single diget add a 0
   if (this.getHours() < 10) {
      return '0' + this.getHours();
   }//from  w w w.  j  a  va2  s  . c  o  m
   return this.getHours();
};

Related

  1. getFullHours()
    Date.prototype.getFullHours = function () {
      return ('0' + this.getHours()).slice(-2);
    };
    
  2. getAMPMHour()
    Date.padded2 = function(hour) { padded2 = hour.toString(); if ((parseInt(hour) < 10) || (parseInt(hour) == null)) padded2="0" + padded2; return padded2; }
    Date.prototype.getAMPMHour = function() { hour=Date.padded2(this.getHours()); return (hour == null) ? 00 : (hour > 24 ? hour - 24 : hour ) }
    Date.prototype.getAMPM = function() { return (this.getHours() < 12) ? "" : ""; }
    Date.prototype.toFormattedString = function(include_time)
       str = this.getFullYear() + "." + Date.padded2(this.getMonth()+1) + "." + Date.padded2(this.getDate());
       if (include_time) { str += " " + this.getHours() + ":" + this.getPaddedMinutes() }
       return str;
    
  3. getBeautifulHour()
    Date.prototype.getBeautifulHour = function() {
      var hour = this.getHours(),
        minutes = this.getMinutes();
      hour = (hour < 10) ? '0' + hour : hour;
      minutes = (minutes < 10) ? '0' + minutes : minutes
      return hour + ':' + minutes;
    
  4. getHour()
    Date.prototype.getHour = function () {
        return (this.getHours() < 10 ? '0' : '') + this.getHours();
    };
    
  5. getHoursFormatted(number)
    Date.prototype.getHoursFormatted = function(number) {
        var hours = this.getHours();
        return hours < 10 ? '0' + hours : hours;
    };