ผมลองแก้ไขในส่วนนี้แล้ว เป็น format = 'd/m/Y'; แต่รูปแบบที่ได้ก็ยังเหมือนเดิมอ่ะครับ หรือว่าต้องแก้ในส่วนไหนอีกป่าวครับ Code (JavaScript)
Date.prototype.dateFormat = function(format)
{
if(!format) { // the default date format to use - can be customized to the current locale
format = 'd/m/Y';
}
LZ = function(x) {return(x < 0 || x > 9 ? '' : '0') + x};
var MONTH_NAMES = new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var DAY_NAMES = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
format = format + "";
var result="";
var i_format=0;
var c="";
var token="";
var y=this.getFullYear().toString();
var M=this.getMonth()+1;
var d=this.getDate();
var E=this.getDay();
var H=this.getHours();
var m=this.getMinutes();
var s=this.getSeconds();
var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
// Convert real this parts into formatted versions
var value = new Object();
//if (y.length < 4) {y=''+(y-0+1900);}
value['Y'] = y.toString();
value['y'] = y.substring(2);
value['n'] = M;
value['m'] = LZ(M);
value['F'] = MONTH_NAMES[M-1];
value['M'] = MONTH_NAMES[M+11];
value['j'] = d;
value['d'] = LZ(d);
value['D'] = DAY_NAMES[E+7];
value['l'] = DAY_NAMES[E];
value['G'] = H;
value['H'] = LZ(H);
if (H==0) {value['g']=12;}
else if (H>12){value['g']=H-12;}
else {value['g']=H;}
value['h']=LZ(value['g']);
if (H > 11) {value['a']='pm'; value['A'] = 'PM';}
else { value['a']='am'; value['A'] = 'AM';}
value['i']=LZ(m);
value['s']=LZ(s);
//construct the result string
while (i_format < format.length) {
c=format.charAt(i_format);
token="";
while ((format.charAt(i_format)==c) && (i_format < format.length)) {
token += format.charAt(i_format++);
}
if (value[token] != null) { result=result + value[token]; }
else { result=result + token; }
}
return result;
};