Here you can find the source of getFormatTime()
Date.prototype.getFormatTime = function (){ var date = ''; date += this.getFullYear() < 10 ? '0' + this.getFullYear() +'-' : this.getFullYear() +'-' ; date += this.getMonth() + 1 < 10 ? '0' + (this.getMonth() + 1) +'-' : (this.getMonth() + 1) + '-'; date += this.getDate()< 10 ? '0' + (this.getDate()) : this.getDate() + ' '; date += this.getHours()< 10 ? '0' + (this.getHours()) +'-' : this.getHours() + ':'; date += this.getMinutes() < 10 ? '0' + (this.getMinutes()) +'-' : this.getMinutes() + ':'; date += this.getSeconds() < 10 ? '0' + (this.getSeconds()) : this.getSeconds(); // ww w.jav a2 s. c om return date; } exports.logging = Logging;
Date.prototype.datetime = function() { var y = this.getFullYear(); var M = this.getMonth() + 1; var d = this.getDate(); var h = this.getHours(); var m = this.getMinutes(); var s = this.getSeconds(); M = M < 10 ? '0' + M : M; d = d < 10 ? '0' + d : d; ...
Date.prototype.distance_of_time_in_words = function(to) { distance_in_milliseconds = to - this; distance_in_minutes = Math.round(Math.abs(distance_in_milliseconds / 60000)); if (distance_in_minutes == 0) { words = "less than a minute"; } else if (distance_in_minutes == 1) { words = "1 minute"; } else if (distance_in_minutes < 45) { words = distance_in_minutes + " minutes"; ...
Date.fromUnixTime = function(value) { return new Date(value * 1000); };
Date.prototype.getDateTimeStr = function () { let month = this.getMonth() + 1; if (month < 10) month = '0' + month; let day = this.getDate(); if (day < 10) day = '0' + day; return this.getFullYear() + '-' + month + '-' + day + ' ' + this.getTimeAmPm(); };
Date.prototype.getDigitalTime = function(){ if (this.getHours() > 12){ var hour = this.getHours() - 12; var ampm = "PM"; }else{ var hour = this.getHours(); var ampm = "AM"; if (this.getMinutes() < 10) ...
Date.prototype.getFullDateTime = function() { return this.getFullYear()+'-'+this.getMonthFormatted()+'-'+this.getDayFormatted()+' '+this.getHoursFormatted()+':'+this.getMinutesFormatted()+':'+this.getSecondsFormatted();
Date.prototype.getNumberTime = function() { var hour = this.getHours(); if (this.getMinutes().length == 1) var min = "0" + this.getMinutes(); else{var min = this.getMinutes();} var secs = this.getSeconds(); return hour +":"+ min +":"+ secs;
Date.prototype.getPrettyDateTime = function () { var month = this.getMonth() + 1; var day = (this.getDate() < 10) ? "0" + this.getDate() : this.getDate(); return month + "/" + day + "/" + this.getFullYear() + " " + this.getPrettyTime(); };
Date.prototype.getPrettyTime = function () { var minutes = (this.getMinutes() < 10) ? "0" + this.getMinutes() : this.getMinutes(); var hours = this.getHours(); var ampm = "AM"; if (hours > 12) { ampm = "PM"; hours -= 12; } else if (hours == 12) { ampm = "PM"; ...