Nodejs Hour Get millisPerHour()

Here you can find the source of millisPerHour()

Method Source Code

Date.millisPerHour = function(){ return 3600 * 1000 };
Date.millisPerDay = function(){ return 24 * Date.millisPerHour() };
Date.millisPerYear = function(){ return Date.millisPerDay() * 365 };
Date.yearsFromNow = function(years){ return Date.fromMillis(Date.clone().getTime() + Date.millisPerYear() * years) };
Date.hoursAgo = function(hours){ return Date.fromMillis(Date.clone().getTime() - Date.millisPerHour() * hours) };
Date.daysAgo = function(days){ return Date.fromMillis(Date.clone().getTime() - Date.millisPerDay() * days) };
Date.fromMillis = function(millis)
{
   return new Date(millis);
}

Date.prototype.setSlots({/* www  .  j av  a 2 s . c o m*/
   startOfUTCDay: function()
   {
      return new Date(Math.floor(this.getTime() / Date.millisPerDay()) * Date.millisPerDay());
   }
})

Related

  1. getHour()
    Date.prototype.getHour = function () {
        return (this.getHours() < 10 ? '0' : '') + this.getHours();
    };
    
  2. getHoursFormatted(number)
    Date.prototype.getHoursFormatted = function(number) {
        var hours = this.getHours();
        return hours < 10 ? '0' + hours : hours;
    };
    
  3. getHoursTwoDigits()
    Date.prototype.getHoursTwoDigits = function()
        var retval = this.getHours();
        if (retval < 10)
            return ("0" + retval.toString());
        else
            return retval.toString();
    };
    
  4. getSimpleHoursgetSimpleHours()
    Date.prototype.getSimpleHours = function getSimpleHours() {
      var ss_ofs = this.getDaySimpleSeconds();
      var sm_ofs = Math.floor(ss_ofs/100);
      var sh_ofs = Math.floor(sm_ofs/100);
      return sh_ofs;
    
  5. hourAgo()
    Date.prototype.hourAgo = function () {
      this.setHours(this.getHours() - 1);
      return this;
    
  6. minusHours(hrs)
    Date.prototype.minusHours = function(hrs) {
        this.setHours(this.getHours() - hrs);
        return this;
    };
    
  7. removeHours(h)
    Date.prototype.removeHours = function (h) {
      this.setHours(this.getHours()-h);
      return this;
    };
    
  8. roundToHour()
    Date.prototype.roundToHour = function() {
        if (this.getMinutes() == 0)
            return; 
        if (this.getHours() < 23)
            this.setHours(this.getHours() + 1);
        this.setMinutes(0);
    };