Nodejs Date Convert toTimeInputValue(()

Here you can find the source of toTimeInputValue(()

Method Source Code

Date.prototype.toTimeInputValue = (function() {
  var local = new Date(this);
  local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
  return local.toJSON().slice(11,19);
});/*  w  w  w  .j a v  a 2  s  . c o  m*/

Related

  1. toShortTime()
    Date.prototype.toShortTime = function() {
        return ('0' + this.getHours()).slice(-2) + ':' + ('0' + this.getMinutes()).slice(-2);
    
  2. toSource()
    Date.prototype.toSource = function(){
      return '(new Date(' + this.valueOf() + '))';
    };
    
  3. toStartTimeInputValue(()
    Date.prototype.toStartTimeInputValue = (function() {
      var local = new Date(this);
      local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
      return local.toJSON().slice(11,13) + ":00:00";
    });
    
  4. toText()
    Date.prototype.toText=function(){ 
      var m; 
      var d; 
      if(this.getMonth()<9){ 
      m="0"+(this.getMonth()+1); 
      }else{ 
      m=this.getMonth()+1; 
      if(this.getDate()<10){ 
    ...
    
  5. toTime()
    Date.prototype.toTime = function () {
        var hours = this.getHours();
        var minutes = this.getMinutes();
        if (minutes < 10)
            minutes = "0" + minutes;
        if (hours < 10)
            hours = "0" + hours;
        return hours + ':' + minutes;
    };
    ...
    
  6. toTurkishFormatDate(format)
    Date.prototype.toTurkishFormatDate = function(format) {
        var date = this,
                day = date.getDate(),
                weekDay = date.getDay(),
                month = date.getMonth() + 1,
                year = date.getFullYear(),
                hours = date.getHours(),
                minutes = date.getMinutes(),
                seconds = date.getSeconds();
    ...
    
  7. toUniversalDate()
    Date.prototype.toUniversalDate = function() {
        var localTime = this.getTime();
        var localOffset = this.getTimezoneOffset() * 60000;
        return new Date(localTime + localOffset);
    };
    
  8. toUnixTime()
    Date.prototype.toUnixTime = function() {
        return Math.round(this.getTime() / 1000);
    };
    
  9. toYYYYMMDD()
    Date.prototype.toYYYYMMDD = function() {
        return this.getFullYear() + String(this.getMonth()+1).lpad(2, "0") + String(this.getDate()).lpad(2, "0");