Nodejs Time Convert second()

Here you can find the source of second()

Method Source Code

Number.prototype.second = function() {
  return this;//from  w  ww  .  j a  v a2  s.c  o m
};

Number.prototype.seconds = function() {
  return this.second();
};

Number.prototype.minute = function() {
  return this.seconds() * 60;
};

Number.prototype.minutes = function() {
  return this.minute();
};

Number.prototype.hour = function() {
  return this.minutes() * 60;
};

Number.prototype.hours = function() {
  return this.hour();
};

Number.prototype.day = function() {
  return this.hours() * 24;
};

Number.prototype.days = function() {
  return this.day();
};

Number.prototype.week = function() {
  return this.days() * 7;
};

Number.prototype.weeks = function() {
  return this.week();
};

Number.prototype.month = function() {
  return this.days() * 30;
};

Number.prototype.months = function() {
  return this.month();
};

Number.prototype.year = function() {
  return this.days() * 365;
};

Number.prototype.years = function() {
  return this.year();
};

Related

  1. getWeek()
    Number.prototype.getWeek=function(){
        var weekDayList=["?","?","?","?","?","?","?"] ;
        var date=new Date(this.dateFormat());
        var weekDay=weekDayList[date.getDay()];
        return weekDay;
    
  2. getWeekDayFromNow(num)
    Number.prototype.getWeekDayFromNow=function(num){
        var date=this;
        var ymd=[];
        var res=[];
        ymd.push(date.getFullYear());
        ymd.push(Number(date.getMonth()+1).addZero());
        ymd.push(Number(date.getDate()).addZero());
        var origin=Number(ymd.join(""));
        res.push(origin+"");
    ...
    
  3. minute()
    Number.prototype.minute = Number.prototype.minutes = function() {
      return (this * 60 * 1000);
    };
    
  4. minutes()
    Number.prototype.minutes = function () {
      var i = this.valueOf();
      var t = new Date(1000 * 60 * i);
      return new Date(t).getTime();
    };
    
  5. months()
    Number.prototype.months = function () {
      var i = this.valueOf();
      var t = new Date(1000 * 60 * 60 * 24 * 30 * i);
      return new Date(t).getTime();
    };
    
  6. seconds()
    Number.prototype.seconds = function(){return this * 1000};
    Number.prototype.second = Number.prototype.seconds;
    Number.prototype.minutes = function(){return this.seconds() * 60};
    Number.prototype.minute = Number.prototype.minutes;
    Number.prototype.hours = function(){return this.minutes() * 60};
    Number.prototype.hour = Number.prototype.hours;
    Number.prototype.days = function(){return this.hours() * 24};
    Number.prototype.day = Number.prototype.days
    
  7. seconds()
    Number.prototype.seconds = function () {
      var i = this.valueOf();
      var t = new Date(1000 * i);
      return new Date(t).getTime();
    };
    
  8. years()
    Number.prototype.years = function () {
      var i = this.valueOf();
      var t = new Date(1000 * 60 * 60 * 24 * 30 * 365 * i);
      return new Date(t).getTime();
    };