The function returns the time in 24 hour format.
function fomartTimeShow(h) {
return h < 10 ? \"0\" + h + \":00\" : h + \":00\";
}
I'm pretty sure this will work as an even more concise formulaic version of Ben Lee's answer, including for the h=0 and h=12 cases:
function fomartTimeShow(h_24) {
var h = ((h_24 + 11) % 12)+1;
return (h < 10 ? '0' : '') + h + ':00';
}
or including am/pm:
function fomartTimeShow(h_24) {
var h = ((h_24 + 11) % 12)+1;
return (h < 10 ? '0' : '') + h + ':00' + (h_24 < 12 ? 'am' : 'pm');
}