# Digital clock

**URL:** <https://forum.kirupa.com/t/digital-clock/115654>\
**Category:** Uncategorized\
**Created:** [July 10, 2004, 2:56pm UTC](https://forum.kirupa.com/t/digital-clock/115654 "2004-07-10T14:56:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jedinitex](https://avatars.discourse-cdn.com/v4/letter/j/34f0e0/32.png) [@jedinitex](https://forum.kirupa.com/u/jedinitex)\
**Post date:** [July 10, 2004, 2:56pm UTC](https://forum.kirupa.com/t/digital-clock/115654/1 "2004-07-10T14:56:15Z")

</div>

I’m making a digital clock to put on my site. I used the tutorial from here on kirupa but i’m still having some trouble. For the minutes and hours, if the value is less than 10 it should have a zero in front of it, but it’s not showing up for me. I used the code that he had posted:

onClipEvent (enterFrame) {  
myTime = new Date();  
nSeconds = myTime.getSeconds();  
nMinutes = myTime.getMinutes();  
nHours = myTime.getHours();  
if (nHours\>=12) {  
ampm = “pm”;  
} else {  
ampm = “am”;  
}  
if (nHours\>=13) {  
nHours = nHours-12;  
}  
if (nHours==0) {  
nHours = 12;  
}  
if (length(nMinutes) == 1) {  
nHinutes = “0”+nMinutes;  
}  
if (length(nSeconds) == 1) {  
nSeconds = “0”+nSeconds;  
}  
nTime = nHours+":"+nMinutes+":"+nSeconds+" "+ampm;  
}

what’s wrong? Thanks!
