# Flash Clock

**URL:** https://forum.kirupa.com/t/flash-clock/77940
**Category:** flash
**Created:** [January 31, 2005, 10:27pm UTC](https://forum.kirupa.com/t/flash-clock/77940 "2005-01-31T22:27:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![1219](https://avatars.discourse-cdn.com/v4/letter/1/f08c70/32.png) [@1219](https://forum.kirupa.com/u/1219)
#### Post date: [January 31, 2005, 10:27pm UTC](https://forum.kirupa.com/t/flash-clock/77940/1 "2005-01-31T22:27:35Z")

</div>

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
