Here you can find the source of Format(fmt)
var prefix = ""; var prefix = "http://192.168.100.167:8086"; Date.prototype.Format = function (fmt) { var o = {// w w w.ja v a2s . c o m "M+": this.getMonth() + 1, //?? "d+": this.getDate(), //? "h+": this.getHours(), //?? "m+": this.getMinutes(), //? "s+": this.getSeconds(), //? "q+": Math.floor((this.getMonth() + 3) / 3), //?? "S": this.getMilliseconds() //?? }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; }; function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i"); var r = window.location.search.split("?")[1].match(reg); if (r!=null) return (r[2]); return null; } Date.prototype.day_of_week_short = function() { // Get full date name var dayName = this.day_of_week_full(); // Retun first three characters return dayName.substring(0, 3); }; Date.prototype.day_of_week_two = function() { // Get full date name var dayName = this.day_of_week_short(); // Retun first three characters return dayName.substring(0, 2); }; Date.prototype.day_of_week_single = function() { // Get full date name var dayName = this.day_of_week_short(); // Retun first three characters return dayName.substring(0, 1); }; Date.prototype.month_full = function() { // Get day as number var monthNumber = this.getMonth(); // Translate to text var monthName; switch (monthNumber) { case 0: monthName = 'January'; break; case 1: monthName = 'February'; break; case 2: monthName = 'March'; break; case 3: monthName = 'April'; break; case 4: monthName = 'May'; break; case 5: monthName = 'June'; break; case 6: monthName = 'July'; break; case 7: monthName = 'August'; break; case 8: monthName = 'September'; break; case 9: monthName = 'October'; break; case 10: monthName = 'November'; break; case 11: monthName = 'December'; break; default: break; } return monthName; }; Date.prototype.month_short = function() { // Get full date name var monthName = this.month_full(); // Retun first three characters return monthName.substring(0, 3); };
Date.prototype.Format = function (fmt) { str = fmt; str = str.replace(/yyyy|YYYY/, this.getFullYear()); str = str.replace(/mm/, this.getMonth() >= 9 ? this.getMonth() + 1 : '0' + (this.getMonth() + 1)); str = str.replace(/dd/, this.getDate() > 9 ? this.getDate() : '0' + this.getDate()); str = str.replace(/HH/, this.getHours() > 9 ? this.getHours() : '0' + this.getHours()); str = str.replace(/MM/, this.getMinutes() > 9 ? this.getMinutes() : '0' + this.getMinutes()); str = str.replace(/SS/, this.getSeconds() > 9 ? this.getSeconds() : '0' + this.getSeconds()); return str; ...
Date.prototype.Format = function(fmt) { var o = { "M+": this.getMonth() + 1, "d+": this.getDate(), "h+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "q+": Math.floor((this.getMonth() + 3) / 3), "S": this.getMilliseconds() ...
Date.prototype.Format = function (fmt) { if (fmt == undefined) { fmt = "yyyy/MM/dd-hh:mm:ss"; var o = { "M+": this.getMonth() + 1, "d+": this.getDate(), "h+": this.getHours(), "m+": this.getMinutes(), ...
Date.prototype.Format = function (fmt) { var o = { "M+": this.getMonth() + 1, "d+": this.getDate(), "h+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "q+": Math.floor((this.getMonth() + 3) / 3), "S": this.getMilliseconds() ...
Date.prototype.Format = function (fmt) { var o = { "M+": this.getMonth() + 1, "d+": this.getDate(), "h+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "q+": Math.floor((this.getMonth() + 3) / 3), "S": this.getMilliseconds() ...
Date.prototype.Format = function (fmt) { var o = { "M+": this.getMonth() + 1, "d+": this.getDate(), "H+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "q+": Math.floor((this.getMonth() + 3) / 3), "S": this.getMilliseconds() ...
Date.prototype.Format = function(format) { var o = { "M+" : this.getMonth() + 1, "d+" : this.getDate(), "h+" : this.getHours(), "m+" : this.getMinutes(), "s+" : this.getSeconds(), "q+" : Math.floor((this.getMonth() + 3) / 3), "S" : this.getMilliseconds() ...
Date.prototype.Format = function (format) { var date = { 'Y+': this.getFullYear(), "M+": this.getMonth() + 1, "D+": this.getDate(), "H+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "S": this.getMilliseconds() ...
Date.prototype.Format = function(formatStr) var str = formatStr; str=str.replace(/yyyy|YYYY/,this.getFullYear()); str=str.replace(/yy|YY/,(this.getYear() % 100)>9?(this.getYear() % 100).toString():'0' + (this.getYear() % 100)); str=str.replace(/MM/,this.getMonth()>9?(this.getMonth()).toString():'0' + (this.getMonth()+1)); str=str.replace(/M/g,this.getMonth()); str=str.replace(/dd|DD/,this.getDate()>9?this.getDate().toString():'0' + this.getDate()); str=str.replace(/d|D/g,this.getDate()); ...