fungsi thc_displayTime(strDate,type)
{
if (strDate == null) {return "";}
if (strDate == "" ) {return "";}
var r = thc_getMatchTimeArr(strDate);
if ( r== null) {
return strDate;
}
if (r[r.length-1] == " AM" ) {
var hh = parseInt(r[5], 10);
if ( (!isNaN(hh)) && hh == 12 ) {
r[5] = 0;
}
}
if (r[r.length-1] == " PM" ) {
var hh = parseInt(r[5], 10);
if ( (!isNaN(hh)) && hh < 12 ) {
r[5] = hh + 12;
}
}
if(type==1) //short date
{
return String.format("{{0}}\/{{1}}\/{{2}} ", r[1], r[3], r[4]);
}
else if(type==2) //mm/dd/yy hh:mm
{
return String.format("{{0}}\/{{1}}\/{{2}} {{3}}:{{4}}", r[1], r[3], r[4], r[5], r[6]);
}
else if(type==3) //mm/dd hh:mm
{
return String.format("{{0}}\/{{1}} {{2}}:{{3}}", r[1], r[3], r[5], r[6]);
}
else if(type==4) //mm/dd/yy hh:mm
{
return String.format("{{0}}\/{{1}}\/{{2}} {{3}}:{{4}}", r[1], r[3], r[4].substr(2), r[5], r[6]);
}
else if(type==5) //yy-mm-dd
{
return String.format("{{0}}-{{1}}-{{2}} ", r[4], r[1], r[3]);
}
else if(type==6) //yy/dd/mm hh:mm
{
return String.format("{{2}}\/{{1}}\/{{0}} {{3}}:{{4}}", r[1], r[3], r[4], r[5], r[6]);
}
else if(type==7) //mm/dd/yyyy hh:mm
{
return String.format("{{0}}\/{{1}}\/{{2}} {{3}}:{{4}}", r[1].length == 1 ? "0" + r[1]:r[1], r[3], r[4], r[5], r[6]);
}
else if(type==8) //mm/dd/yy
{
return String.format("{{0}}\/{{1}}\/{{2}}", r[1], r[3], r[4]);
}
else
{
return String.format("{{0}}\/{{1}}\/{{2}} {{3}}:{{4}}:{{5}}", r[1], r[3], r[4].substr(2), r[5], r[6], r[8]);
}
}
Gunakan perpustakaan ini untuk seketika Ia boleh memuaskan pada dasarnya apa jua keadaan