Flash Clock

I have built this flash clock. However when it comes to 12 Noon, it still gives an AM instead of PM. when it changes to 1 Afternoon then it goes to PM.

here is the code:
////////////////////////////////////////////////////////////////////mydate = new Date();
seconds = mydate.getSeconds();
minutes = mydate.getMinutes();
hours = mydate.getHours();
day = mydate.getDay();
date = mydate.getDate();
month = mydate.getMonth();
year = mydate.getFullYear();
if (hours>12) {
hours = hours-12;
ampm = “PM”;
} else {
ampm = “AM”;
}
if (hours == 0) {
hours = 12;
}
if (minutes<10) {
minutes = “0”+minutes;
}
if (seconds<10) {
seconds = “0”+seconds;
}
if (day == 0) {
day = “Sunday”;
} else if (day == 1) {
day = “Monday”;
} else if (day == 2) {
day = “Tuesday”;
} else if (day == 3) {
day = “Wednesday”;
} else if (day == 4) {
day = “Thursday”;
} else if (day == 5) {
day = “Friday”;
} else if (day == 6) {
day = “Saturday”;
}
if (month == 0) {
month = “January”;
} else if (month == 1) {
month = “February”;
} else if (month == 2) {
month = “March”;
} else if (month == 3) {
month = “April”;
} else if (month == 4) {
month = “May”;
} else if (month == 5) {
month = “June”;
} else if (month == 6) {
month = “July”;
} else if (month == 7) {
month = “August”;
} else if (month == 8) {
month = “September”;
} else if (month == 9) {
month = “October”;
} else if (month == 10) {
month = “November”;
} else if (month == 11) {
month = “December”;
}
time = ((hours)+":"+(minutes)+":"+(seconds)+" “+(ampm));
datefinal = ((day)+” “+(month)+” “+(date)+”, "+(year));
////////////////////////////////////////////////////////////////////

Can anyone help me?

Thanks