I am working with a code for a binary clock, I am wanting to change the format from 24 hour to 12 hour. I am pretty new to flash so please bear with my ignorance

. I have an idea of which line of code I need to change, but am unclear on exactly what to change it to so that the time displays correctly. Here is the code that I am working with:
this.onEnterFrame = function ()
{
d = new Date();
h = d.getHours();
hh = int(h / 10);
h = h % 10;
hh1.setValue(hh & 2);
hh0.setValue(hh & 1);
h3.setValue(h & 8);
h2.setValue(h & 4);
h1.setValue(h & 2);
h0.setValue(h & 1);
m = d.getMinutes();
mm = int(m / 10);
m = m % 10;
mm2.setValue(mm & 4);
mm1.setValue(mm & 2);
mm0.setValue(mm & 1);
m3.setValue(m & 8);
m2.setValue(m & 4);
m1.setValue(m & 2);
m0.setValue(m & 1);
s = d.getSeconds();
ss = int(s / 10);
s = s % 10;
ss2.setValue(ss & 4);
ss1.setValue(ss & 2);
ss0.setValue(ss & 1);
s3.setValue(s & 8);
s2.setValue(s & 4);
s1.setValue(s & 2);
s0.setValue(s & 1);
};
Thank you for any help you may be able to offer me, or any resources you any be able to direct me towards.
Matt