Nodejs Time Convert years()

Here you can find the source of years()

Method Source Code

Number.prototype.years = function () {
  var i = this.valueOf();
  var t = new Date(1000 * 60 * 60 * 24 * 30 * 365 * i);
  return new Date(t).getTime();
};

Related

  1. minutes()
    Number.prototype.minutes = function () {
      var i = this.valueOf();
      var t = new Date(1000 * 60 * i);
      return new Date(t).getTime();
    };
    
  2. months()
    Number.prototype.months = function () {
      var i = this.valueOf();
      var t = new Date(1000 * 60 * 60 * 24 * 30 * i);
      return new Date(t).getTime();
    };
    
  3. second()
    Number.prototype.second = function() {
      return this;
    };
    Number.prototype.seconds = function() {
      return this.second();
    };
    Number.prototype.minute = function() {
      return this.seconds() * 60;
    };
    ...
    
  4. 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
    
  5. seconds()
    Number.prototype.seconds = function () {
      var i = this.valueOf();
      var t = new Date(1000 * i);
      return new Date(t).getTime();
    };