Nodejs Date Get getPreviousDate(i)

Here you can find the source of getPreviousDate(i)

Method Source Code

Date.prototype.getPreviousDate = function(i){
   return new Date(new Date().setDate(new Date().getDate()-i));
};

Related

  1. getLastDate()
    Date.prototype.getLastDate = function() {
        return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
    
  2. getLocalDateObject()
    Date.prototype.getLocalDateObject = function () {
        return new Date(this.toLocaleString())
    
  3. getMidnight()
    Date.getToday = function() {
       var now = new Date();
       return now.getMidnight();
    };
    Date.prototype.getMidnight = function() {
       return new Date( this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
    };
    
  4. getNextDate(i)
    Date.prototype.getNextDate = function(i){
      return new Date(new Date().setDate(new Date().getDate()+i));
    };
    
  5. getNumberDate()
    Date.prototype.getNumberDate = function() {
      var month = this.getMonth() + 1;
      var day = this.getDate();
      var year = this.getFullYear();  
      return month +"/"+ day +"/"+ year;
    
  6. getSecondsFormatted(number)
    Date.prototype.getSecondsFormatted = function(number) {
        var second = this.getSeconds();
        return second < 10 ? '0' + second : second;
    };
    
  7. getSecondsTwoDigits()
    Date.prototype.getSecondsTwoDigits = function()
        var retval = this.getSeconds();
        if (retval < 10)
            return ("0" + retval.toString());
        else
            return retval.toString();
    };
    
  8. getSimpleMillisecondsgetSimpleMilliseconds()
    Date.prototype.getSimpleMilliseconds = function getSimpleMilliseconds() {
      return (this.getDaySeconds()/ (24*60*60) * (10*100*100)) - this.getDaySimpleSeconds();
    
  9. getSimpleSecondsgetSimpleSeconds()
    Date.prototype.getSimpleSeconds = function getSimpleSeconds() {
      var ss_ofs = this.getDaySimpleSeconds();
      var sm_ofs = Math.floor(ss_ofs/100);
      var sh_ofs = Math.floor(sm_ofs/100);
      return ss_ofs - sm_ofs*100;